summaryrefslogtreecommitdiffstats
path: root/plugins/check_snmp.c
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@aei.ca>2009-03-18 07:47:23 (GMT)
committerThomas Guyot-Sionnest <dermoth@aei.ca>2009-03-18 07:47:23 (GMT)
commite9f5442bb3ad6f6070c12f48ec5e3c0f43e26d9a (patch)
tree27333a8bade35f0e0cf6ea45acf6b9c9be1d43d4 /plugins/check_snmp.c
parentd5ea0d19fae57dc1c54b4429def2bb35cd94414f (diff)
downloadmonitoring-plugins-e9f5442bb3ad6f6070c12f48ec5e3c0f43e26d9a.tar.gz
check_snmp: Fix potential buffer overflow - enforce MAX_OIDS limit (John A. Barbuto)
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r--plugins/check_snmp.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 3dc52df..41a5ea1 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -527,9 +527,8 @@ process_arguments (int argc, char **argv)
527 needmibs = TRUE; 527 needmibs = TRUE;
528 } 528 }
529 oids = calloc(MAX_OIDS, sizeof (char *)); 529 oids = calloc(MAX_OIDS, sizeof (char *));
530 for (ptr = strtok(optarg, ", "); ptr != NULL; ptr = strtok(NULL, ", ")) { 530 for (ptr = strtok(optarg, ", "); ptr != NULL && j < MAX_OIDS; ptr = strtok(NULL, ", "), j++) {
531 oids[j] = strdup(ptr); 531 oids[j] = strdup(ptr);
532 j++;
533 } 532 }
534 numoids = j; 533 numoids = j;
535 if (c == 'E' || c == 'e') { 534 if (c == 'E' || c == 'e') {