summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@aei.ca>2009-08-05 07:12:05 (GMT)
committerThomas Guyot-Sionnest <dermoth@aei.ca>2009-08-05 07:13:08 (GMT)
commitb8a64210bd44d792de6defcdddec65231c1ac65b (patch)
tree3f1b536b53180f3485b2641aebb7e7b08c8a7661 /plugins
parent1295c936519d5e84e94d2751fca5941a8fb8a850 (diff)
downloadmonitoring-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.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index bb3d295..db16462 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -186,7 +186,7 @@ main (int argc, char **argv)
186 }else{ 186 }else{
187 snmpcmd = strdup (PATH_TO_SNMPGET); 187 snmpcmd = strdup (PATH_TO_SNMPGET);
188 } 188 }
189 189
190 /* 9 arguments to pass before authpriv options + 1 for host and numoids. Add one for terminating NULL */ 190 /* 9 arguments to pass before authpriv options + 1 for host and numoids. Add one for terminating NULL */
191 command_line = calloc (9 + numauthpriv + 1 + numoids + 1, sizeof (char *)); 191 command_line = calloc (9 + numauthpriv + 1 + numoids + 1, sizeof (char *));
192 command_line[0] = snmpcmd; 192 command_line[0] = snmpcmd;
@@ -255,15 +255,17 @@ main (int argc, char **argv)
255 ptr = chld_out.line[i]; 255 ptr = chld_out.line[i];
256 oidname = strpcpy (oidname, ptr, delimiter); 256 oidname = strpcpy (oidname, ptr, delimiter);
257 response = strstr (ptr, delimiter); 257 response = strstr (ptr, delimiter);
258 if (response == NULL)
259 break;
260
258 if (verbose > 2) { 261 if (verbose > 2) {
259 printf("Processing line %i\n oidname: %s\n response: %s\n", i+1, oidname, response); 262 printf("Processing line %i\n oidname: %s\n response: %s\n", i+1, oidname, response);
260 } 263 }
261 264
262 /* We strip out the datatype indicator for PHBs */
263
264 /* Clean up type array - Sol10 does not necessarily zero it out */ 265 /* Clean up type array - Sol10 does not necessarily zero it out */
265 bzero(type, sizeof(type)); 266 bzero(type, sizeof(type));
266 267
268 /* We strip out the datatype indicator for PHBs */
267 if (strstr (response, "Gauge: ")) 269 if (strstr (response, "Gauge: "))
268 show = strstr (response, "Gauge: ") + 7; 270 show = strstr (response, "Gauge: ") + 7;
269 else if (strstr (response, "Gauge32: ")) 271 else if (strstr (response, "Gauge32: "))