From eba50a34e2ca4c0823a5cb826c4e2123dab30e7f Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 15 Nov 2017 22:26:11 +0100 Subject: [PATCH] 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 --- src/libcollectdclient/network_buffer.c | 4 ++++ 1 file changed, 4 insertions(+) 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; -- 2.30.2