From: Florian Forster Date: Wed, 15 Nov 2017 21:26:11 +0000 (+0100) Subject: libcollectdclient: Ensure vl->values_len is non-zero. X-Git-Tag: collectd-5.8.0~8^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=eba50a34e2ca4c0823a5cb826c4e2123dab30e7f;p=collectd.git libcollectdclient: Ensure vl->values_len is non-zero. That size_t is then used to declare Variable Length Arrays. Hopefully this helps to convince Coverity that pkg_values and pkg_values_types are actually fully initialized. CID: 141009, 141010 --- diff --git a/src/libcollectdclient/network_buffer.c b/src/libcollectdclient/network_buffer.c index 662265d9..a0f8cfdc 100644 --- a/src/libcollectdclient/network_buffer.c +++ b/src/libcollectdclient/network_buffer.c @@ -255,6 +255,10 @@ static double htond(double val) /* {{{ */ static int nb_add_values(char **ret_buffer, /* {{{ */ size_t *ret_buffer_len, const lcc_value_list_t *vl) { + if ((vl == NULL) || (vl->values_len < 1)) { + return EINVAL; + } + char *packet_ptr; size_t packet_len;