From: Thomas Guyot-Sionnest Date: Wed, 18 Mar 2009 07:47:23 +0000 (-0400) Subject: check_snmp: Fix potential buffer overflow - enforce MAX_OIDS limit (John A. Barbuto) X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e9f5442bb3ad6f6070c12f48ec5e3c0f43e26d9a;p=nagiosplug.git check_snmp: Fix potential buffer overflow - enforce MAX_OIDS limit (John A. Barbuto) --- 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) 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') {