From f782b37840e50f3e21af5c6b8b200fa640730ee7 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 12 Aug 2008 11:30:07 +0200 Subject: [PATCH] snmp plugin: Issue an error if an instance name is empty. --- src/snmp.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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), -- 2.30.2