[Nagiosplug-checkins] CVS: nagiosplug/plugins check_tcp.c,1.37,1.38
Karl DeBisschop
kdebisschop at users.sourceforge.net
Wed Jan 21 04:46:01 CET 2004
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv32540/plugins
Modified Files:
check_tcp.c
Log Message:
=fix segfault on malloc of server_expect for multibyte chars (David Croft)
Index: check_tcp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_tcp.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -r1.37 -r1.38
*** check_tcp.c 11 Nov 2003 10:43:07 -0000 1.37
--- check_tcp.c 21 Jan 2004 12:45:19 -0000 1.38
***************
*** 190,196 ****
SEND = NULL;
EXPECT = NULL;
! server_expect = realloc (server_expect, ++server_expect_count);
asprintf (&server_expect[server_expect_count - 1], "200");
! server_expect = realloc (server_expect, ++server_expect_count);
asprintf (&server_expect[server_expect_count - 1], "201");
asprintf (&QUIT, "QUIT\r\n");
--- 190,196 ----
SEND = NULL;
EXPECT = NULL;
! server_expect = realloc (server_expect, sizeof (char *) * (++server_expect_count));
asprintf (&server_expect[server_expect_count - 1], "200");
! server_expect = realloc (server_expect, sizeof (char *) * (++server_expect_count));
asprintf (&server_expect[server_expect_count - 1], "201");
asprintf (&QUIT, "QUIT\r\n");
***************
*** 213,217 ****
/* use default expect if none listed in process_arguments() */
if (EXPECT && server_expect_count == 0) {
! server_expect = malloc (++server_expect_count);
server_expect[server_expect_count - 1] = EXPECT;
}
--- 213,217 ----
/* use default expect if none listed in process_arguments() */
if (EXPECT && server_expect_count == 0) {
! server_expect = malloc (sizeof (char *) * (++server_expect_count));
server_expect[server_expect_count - 1] = EXPECT;
}
***************
*** 471,477 ****
EXPECT = NULL;
if (server_expect_count == 0)
! server_expect = malloc (++server_expect_count);
else
! server_expect = realloc (server_expect, ++server_expect_count);
server_expect[server_expect_count - 1] = optarg;
break;
--- 471,477 ----
EXPECT = NULL;
if (server_expect_count == 0)
! server_expect = malloc (sizeof (char *) * (++server_expect_count));
else
! server_expect = realloc (server_expect, sizeof (char *) * (++server_expect_count));
server_expect[server_expect_count - 1] = optarg;
break;
More information about the Commits
mailing list