X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Flibcollectdclient%2Fnetwork_buffer.c;h=755d476cab5daf59e52f142537ba6eae95f6f6cb;hb=61a4ed99b1a5b6d371bb745933d0efc5dff9505c;hp=662265d97996d309ef45391dab28079975d2fac6;hpb=5dbb7471b0a7ca7506f56f4c6dbaf58e790c6b7c;p=collectd.git diff --git a/src/libcollectdclient/network_buffer.c b/src/libcollectdclient/network_buffer.c index 662265d9..755d476c 100644 --- a/src/libcollectdclient/network_buffer.c +++ b/src/libcollectdclient/network_buffer.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -122,10 +123,10 @@ struct lcc_network_buffer_s { /* * Private functions */ -static _Bool have_gcrypt(void) /* {{{ */ +static bool have_gcrypt(void) /* {{{ */ { - static _Bool result = 0; - static _Bool need_init = 1; + static bool result = 0; + static bool need_init = 1; if (!need_init) return result; @@ -150,7 +151,7 @@ static _Bool have_gcrypt(void) /* {{{ */ #else return 0; #endif -} /* }}} _Bool have_gcrypt */ +} /* }}} bool have_gcrypt */ #ifndef HAVE_HTONLL static uint64_t htonll(uint64_t val) /* {{{ */ @@ -255,6 +256,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;