summaryrefslogtreecommitdiffstats
path: root/web/attachments/318264-check_snmp_max_oids.patch
blob: c2a321791151e741753dec6f78330ee929b6d85b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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') {