[Nagiosplug-devel] check_tcp - missing string initialization

Hegedus, Ervin airween at freemail.hu
Fri May 28 15:52:48 CEST 2004


hello,

i configured a Nagios, and i try to use nagiosplug. i wanted to
check a Squid proxy, on a remote host, on port 3128.

the check_tcp returns a correct answer, but there was some queer
string in the answer:

$./check_tcp -H proxy -p 3128
TCP OK - 0,021 second response time on port 3128 [
	@{gh.. ]|time=0,020558s;0,000000;0,000000;0,000000;10,000000

(or some like this, i can't access that server at this time.)

i seed the source, and try to give a '\0' to variable 'status',
here is the patch:



--- nagiosplug.orig/plugins/check_tcp.c 2004-03-14 05:09:19.000000000 +0100
+++ nagiosplug/plugins/check_tcp.c      2004-05-29 00:17:57.000000000 +0200
@@ -108,6 +108,8 @@
	bindtextdomain (PACKAGE, LOCALEDIR);
	textdomain (PACKAGE);

+	strcpy(status, '\0');
+
	if (strstr (argv[0], "check_udp")) {
		progname = strdup ("check_udp");
		SERVICE = strdup ("UDP");

this resolved the problem.

may be i help to you :)


bye:
airween






More information about the Devel mailing list