From: Florian Forster Date: Fri, 17 Nov 2017 13:56:06 +0000 (+0100) Subject: snmp plugin: Ensure that index is within bounds. X-Git-Tag: collectd-5.8.0~1^2~1^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8ec942a6f2ac84b193bcc1a286671b7afcb1e86d;p=collectd.git snmp plugin: Ensure that index is within bounds. CID: 81389, 81390 --- 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);