From e9f5442bb3ad6f6070c12f48ec5e3c0f43e26d9a Mon Sep 17 00:00:00 2001 From: Thomas Guyot-Sionnest Date: Wed, 18 Mar 2009 03:47:23 -0400 Subject: check_snmp: Fix potential buffer overflow - enforce MAX_OIDS limit (John A. Barbuto) --- plugins/check_snmp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'plugins') 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') { -- cgit v1.2.3-74-g34f1