From 8ec942a6f2ac84b193bcc1a286671b7afcb1e86d Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 17 Nov 2017 14:56:06 +0100 Subject: [PATCH] snmp plugin: Ensure that index is within bounds. CID: 81389, 81390 --- src/snmp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/snmp.c b/src/snmp.c index 74068ec3..ffeface9 100644 --- a/src/snmp.c +++ b/src/snmp.c @@ -1403,8 +1403,12 @@ static int csnmp_read_table(host_definition_t *host, data_definition_t *data) { for (vb = res->variables, i = 0; (vb != NULL); vb = vb->next_variable, i++) { /* Calculate value index from todo list */ - while ((i < oid_list_len) && !oid_list_todo[i]) + while ((i < oid_list_len) && !oid_list_todo[i]) { i++; + } + if (i >= oid_list_len) { + break; + } /* An instance is configured and the res variable we process is the * instance value (last index) */ @@ -1495,7 +1499,6 @@ static int csnmp_read_table(host_definition_t *host, data_definition_t *data) { snmp_free_pdu(res); res = NULL; - if (status == 0) csnmp_dispatch_table(host, data, instance_list_head, value_list_head); -- 2.30.2