From: Florian Forster Date: Sun, 23 Sep 2012 10:00:43 +0000 (+0200) Subject: ethstat plugin: Initialize realloc'ated memory. X-Git-Tag: collectd-5.1.1~8 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=427297d59bc5686f4ef7b95d689421c6eac9c833;p=collectd.git ethstat plugin: Initialize realloc'ated memory. 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. --- diff --git a/src/ethstat.c b/src/ethstat.c index 746fc613..08381a82 100644 --- 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)