From c1261f015e1cdf53d8d8dbc805a982537e2ca29c Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Mon, 9 Feb 2004 08:27:54 +0000 Subject: Fix for check_ping old-style argument handling (Patrick McCormick - 892211) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@799 f882894a-f735-0410-b71e-b25c423dba1c diff --git a/plugins/check_ping.c b/plugins/check_ping.c index ab5e0cc..1d34656 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c @@ -74,7 +74,8 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - addresses = malloc ((size_t)max_addr); + addresses = malloc (sizeof(char*) * max_addr); + addresses[0] = NULL; if (process_arguments (argc, argv) == ERROR) usage (_("Could not parse arguments")); @@ -228,7 +229,7 @@ process_arguments (int argc, char **argv) n_addresses++; if (n_addresses > max_addr) { max_addr *= 2; - addresses = realloc (addresses, (size_t)max_addr); + addresses = realloc (addresses, sizeof(char*) * max_addr); if (addresses == NULL) die (STATE_UNKNOWN, _("Could not realloc() addresses\n")); } @@ -272,6 +273,7 @@ process_arguments (int argc, char **argv) return ERROR; } else { addresses[0] = argv[c++]; + n_addresses++; if (c == argc) return validate_arguments (); } -- cgit v0.10-9-g596f