From: Florian Forster Date: Tue, 12 Aug 2008 09:30:07 +0000 (+0200) Subject: snmp plugin: Issue an error if an instance name is empty. X-Git-Tag: collectd-4.5.0~78 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f782b378;p=collectd.git snmp plugin: Issue an error if an instance name is empty. --- diff --git a/src/snmp.c b/src/snmp.c index 07465ddd..2026e8bc 100644 --- a/src/snmp.c +++ b/src/snmp.c @@ -863,6 +863,14 @@ static int csnmp_instance_list_add (csnmp_list_instances_t **head, if (instance_len > vb->val_len) instance_len = vb->val_len; + if (instance_len < 1) + { + ERROR ("snmp plugin: csnmp_instance_list_add: instance_len = %zu, " + "which is less than one.", instance_len); + sfree (il); + return (-1); + } + sstrncpy (il->instance, (char *) ((vb->type == ASN_OCTET_STR) ? vb->val.string : vb->val.bitstring),