From: Florian Forster Date: Fri, 1 Dec 2017 11:05:21 +0000 (+0100) Subject: powerdns plugin: Ensure powerdns_get_data() returns a non-NULL buffer. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=5f676ef72a300ae4e8e979b4011cf7e3be505a6a;p=collectd.git powerdns plugin: Ensure powerdns_get_data() returns a non-NULL buffer. Coverity is concerned that if buffer is NULL, strtok_r() is called with two NULL arguments, causing a NULL pointer dereference. CID: 37968 --- diff --git a/src/powerdns.c b/src/powerdns.c index f2149ef2..fa3eef33 100644 --- a/src/powerdns.c +++ b/src/powerdns.c @@ -598,6 +598,9 @@ static int powerdns_read_server(list_item_t *item) /* {{{ */ status = powerdns_get_data(item, &buffer, &buffer_size); if (status != 0) return (-1); + if ((buffer == NULL) || (buffer_size == 0)) { + return EINVAL; + } if (item->fields_num != 0) { fields = (const char *const *)item->fields;