From: Mariusz Szafranski Date: Thu, 29 Mar 2018 08:45:46 +0000 (+0100) Subject: ipmi plugin: Fix for segmentation fault for wrong data type in Sensor section. X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=a73e5d6532bed1216e86af5c15b0acd9fb555026 ipmi plugin: Fix for segmentation fault for wrong data type in Sensor section. Incorrect, malicious data in the Sensor section can cause a segmentation fault. Error message is generated instead of crash after applying this patch. Change-Id: Ibc387b5594f9453f1fc957ed37ceb09cfa34ded5 Signed-off-by: Mariusz Szafranski --- diff --git a/src/ipmi.c b/src/ipmi.c index 6a72b2b7..98cc3b05 100644 --- a/src/ipmi.c +++ b/src/ipmi.c @@ -1062,9 +1062,14 @@ static int c_ipmi_config_add_instance(oconfig_item_t *ci) { for (int i = 0; i < ci->children_num; i++) { oconfig_item_t *child = ci->children + i; - if (strcasecmp("Sensor", child->key) == 0) - ignorelist_add(st->ignorelist, child->values[0].value.string); - else if (strcasecmp("IgnoreSelected", child->key) == 0) { + if (strcasecmp("Sensor", child->key) == 0) { + char *value = NULL; + status = cf_util_get_string(child, &value); + if (status != 0) + break; + ignorelist_add(st->ignorelist, value); + sfree(value); + } else if (strcasecmp("IgnoreSelected", child->key) == 0) { _Bool t; status = cf_util_get_boolean(child, &t); if (status != 0)