diff options
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2009-08-05 03:12:05 -0400 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2009-08-05 03:13:08 -0400 |
commit | b8a64210bd44d792de6defcdddec65231c1ac65b (patch) | |
tree | 3f1b536b53180f3485b2641aebb7e7b08c8a7661 /plugins | |
parent | 1295c936519d5e84e94d2751fca5941a8fb8a850 (diff) | |
download | monitoring-plugins-b8a64210bd44d792de6defcdddec65231c1ac65b.tar.gz |
Fix segfault in check_snmp (definitive fix is still in the works - see bug #2832451)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_snmp.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index bb3d295e..db16462b 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -186,7 +186,7 @@ main (int argc, char **argv) }else{ snmpcmd = strdup (PATH_TO_SNMPGET); } - + /* 9 arguments to pass before authpriv options + 1 for host and numoids. Add one for terminating NULL */ command_line = calloc (9 + numauthpriv + 1 + numoids + 1, sizeof (char *)); command_line[0] = snmpcmd; @@ -255,15 +255,17 @@ main (int argc, char **argv) ptr = chld_out.line[i]; oidname = strpcpy (oidname, ptr, delimiter); response = strstr (ptr, delimiter); + if (response == NULL) + break; + if (verbose > 2) { printf("Processing line %i\n oidname: %s\n response: %s\n", i+1, oidname, response); } - /* We strip out the datatype indicator for PHBs */ - /* Clean up type array - Sol10 does not necessarily zero it out */ bzero(type, sizeof(type)); + /* We strip out the datatype indicator for PHBs */ if (strstr (response, "Gauge: ")) show = strstr (response, "Gauge: ") + 7; else if (strstr (response, "Gauge32: ")) |