From: Ruben Kerkhof Date: Sun, 24 Jul 2016 11:29:25 +0000 (+0200) Subject: network plugin: unsigned variables can't be negative X-Git-Tag: collectd-5.6.0~176 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8391a4430d5dffea44898adb628a5bcdbcfe31ba;p=collectd.git network plugin: unsigned variables can't be negative --- diff --git a/src/network.c b/src/network.c index ac076ccc..d3c60442 100644 --- a/src/network.c +++ b/src/network.c @@ -410,10 +410,10 @@ static int network_dispatch_values (value_list_t *vl, /* {{{ */ { int status; - if ((vl->time <= 0) - || (strlen (vl->host) <= 0) - || (strlen (vl->plugin) <= 0) - || (strlen (vl->type) <= 0)) + if ((vl->time == 0) + || (strlen (vl->host) == 0) + || (strlen (vl->plugin) == 0) + || (strlen (vl->type) == 0)) return (-EINVAL); if (!check_receive_okay (vl)) @@ -1246,7 +1246,7 @@ static int parse_part_encr_aes256 (sockent_t *se, /* {{{ */ BUFFER_READ (&username_len, sizeof (username_len)); username_len = ntohs (username_len); - if ((username_len <= 0) + if ((username_len == 0) || (username_len > (part_size - (PART_ENCRYPTION_AES256_SIZE + 1)))) { NOTICE ("network plugin: parse_part_encr_aes256: " @@ -1579,13 +1579,13 @@ static int parse_packet (sockent_t *se, /* {{{ */ "unknown severity %i.", n.severity); } - else if (n.time <= 0) + else if (n.time == 0) { INFO ("network plugin: " "Ignoring notification with " "time == 0."); } - else if (strlen (n.message) <= 0) + else if (strlen (n.message) == 0) { INFO ("network plugin: " "Ignoring notification with "