From 8391a4430d5dffea44898adb628a5bcdbcfe31ba Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Sun, 24 Jul 2016 13:29:25 +0200 Subject: [PATCH] network plugin: unsigned variables can't be negative --- src/network.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 " -- 2.11.0