aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_snmp.c
diff options
context:
space:
mode:
authorGravatar Thomas Guyot-Sionnest <dermoth@aei.ca> 2009-03-18 03:47:23 -0400
committerGravatar Thomas Guyot-Sionnest <dermoth@aei.ca> 2009-03-18 03:47:23 -0400
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 3dc52dff..41a5ea1a 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -527,9 +527,8 @@ process_arguments (int argc, char **argv)
needmibs = TRUE;
}
oids = calloc(MAX_OIDS, sizeof (char *));
- for (ptr = strtok(optarg, ", "); ptr != NULL; ptr = strtok(NULL, ", ")) {
+ for (ptr = strtok(optarg, ", "); ptr != NULL && j < MAX_OIDS; ptr = strtok(NULL, ", "), j++) {
oids[j] = strdup(ptr);
- j++;
}
numoids = j;
if (c == 'E' || c == 'e') {