From 427297d59bc5686f4ef7b95d689421c6eac9c833 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sun, 23 Sep 2012 12:00:43 +0200 Subject: [PATCH] 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. --- src/ethstat.c | 1 + 1 file changed, 1 insertion(+) 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) -- 2.11.0