projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
eb44b1e
)
ethstat plugin: Initialize realloc'ated memory.
author
Florian Forster
<octo@collectd.org>
Sun, 23 Sep 2012 10:00:43 +0000
(12:00 +0200)
committer
Florian Forster
<octo@collectd.org>
Sun, 23 Sep 2012 10:00:43 +0000
(12:00 +0200)
The last element in "interfaces" is not guaranteed to be zeroed, resulting in a
segfault when cf_util_get_string() tries to free the "pointer".
Thanks to Mark T. Voelker for reporting and analyzing this bug!
This should fix Github issue #133.
src/ethstat.c
patch
|
blob
|
history
diff --git
a/src/ethstat.c
b/src/ethstat.c
index
746fc61
..
08381a8
100644
(file)
--- a/
src/ethstat.c
+++ b/
src/ethstat.c
@@
-66,6
+66,7
@@
static int ethstat_add_interface (const oconfig_item_t *ci) /* {{{ */
if (tmp == NULL)
return (-1);
interfaces = tmp;
+ interfaces[interfaces_num] = NULL;
status = cf_util_get_string (ci, interfaces + interfaces_num);
if (status != 0)