summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: aec20e4)
raw | patch | inline | side by side (parent: aec20e4)
author | Florian Forster <octo@noris.net> | |
Wed, 27 Aug 2008 10:08:33 +0000 (12:08 +0200) | ||
committer | Florian Forster <octo@noris.net> | |
Wed, 27 Aug 2008 10:08:33 +0000 (12:08 +0200) |
The last character of an table instance was truncated. Fortunately empty
strings were caught, so that uninitialized memory was never accessed.
This patch also reverts f782b378: If returning with an error when a string
is empty causes the entire read to fail.
strings were caught, so that uninitialized memory was never accessed.
This patch also reverts f782b378: If returning with an error when a string
is empty causes the entire read to fail.
src/snmp.c | patch | blob | history |
diff --git a/src/snmp.c b/src/snmp.c
index 0dad67c8b727232cc0072bd68eb77d7fbd8a5002..877aafe92b2bf959f8604916776020460b847ea2 100644 (file)
--- a/src/snmp.c
+++ b/src/snmp.c
char *ptr;
size_t instance_len;
+ memset (il->instance, 0, sizeof (il->instance));
instance_len = sizeof (il->instance) - 1;
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),
- instance_len);
+ instance_len + 1);
for (ptr = il->instance; *ptr != '\0'; ptr++)
{