[Nagiosplug-checkins] CVS: nagiosplug/plugins check_tcp.c,1.13.2.3,1.13.2.4

Karl DeBisschop kdebisschop at users.sourceforge.net
Wed Jan 21 04:50:01 CET 2004


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv827/plugins

Modified Files:
      Tag: r1_3_0
	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.13.2.3
retrieving revision 1.13.2.4
diff -C2 -r1.13.2.3 -r1.13.2.4
*** check_tcp.c	2 Jun 2003 14:46:48 -0000	1.13.2.3
--- check_tcp.c	21 Jan 2004 12:49:12 -0000	1.13.2.4
***************
*** 188,194 ****
  		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");
--- 188,194 ----
  		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");
***************
*** 210,214 ****
  	/* 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;
  	}
--- 210,214 ----
  	/* 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;
  	}
***************
*** 448,454 ****
  			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;
--- 448,454 ----
  			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