aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2004-01-21 12:49:12 +0000
committerGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2004-01-21 12:49:12 +0000
commit9b5b447fcae3a1e3dcd5c00734eed34b0dc91857 (patch)
tree90b9b352f8a7120886642513932a2f6a72ece35a /plugins
parentf152e45257451d5b898373db6dfad6ee123199b1 (diff)
downloadmonitoring-plugins-9b5b447fcae3a1e3dcd5c00734eed34b0dc91857.tar.gz
=fix segfault on malloc of server_expect for multibyte chars (David Croft)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@796 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_tcp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index c105c6ae..7bd48d1a 100644
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
@@ -189,9 +189,9 @@ main (int argc, char **argv)
SERVICE = strdup ("NNTP");
SEND = NULL;
EXPECT = NULL;
- server_expect = realloc (server_expect, ++server_expect_count);
+ server_expect = realloc (server_expect, sizeof (char *) * (++server_expect_count));
asprintf (&server_expect[server_expect_count - 1], "200");
- server_expect = realloc (server_expect, ++server_expect_count);
+ server_expect = realloc (server_expect, sizeof (char *) * (++server_expect_count));
asprintf (&server_expect[server_expect_count - 1], "201");
asprintf (&QUIT, "QUIT\r\n");
PROTOCOL = TCP_PROTOCOL;
@@ -212,7 +212,7 @@ main (int argc, char **argv)
/* use default expect if none listed in process_arguments() */
if (EXPECT && server_expect_count == 0) {
- server_expect = malloc (++server_expect_count);
+ server_expect = malloc (sizeof (char *) * (++server_expect_count));
server_expect[server_expect_count - 1] = EXPECT;
}
@@ -470,9 +470,9 @@ process_arguments (int argc, char **argv)
case 'e': /* expect string (may be repeated) */
EXPECT = NULL;
if (server_expect_count == 0)
- server_expect = malloc (++server_expect_count);
+ server_expect = malloc (sizeof (char *) * (++server_expect_count));
else
- server_expect = realloc (server_expect, ++server_expect_count);
+ server_expect = realloc (server_expect, sizeof (char *) * (++server_expect_count));
server_expect[server_expect_count - 1] = optarg;
break;
case 'm':