From: Ruben Kerkhof Date: Sat, 23 Jul 2016 13:30:44 +0000 (+0200) Subject: madwifi plugin: fix buffer overflows X-Git-Tag: collectd-5.6.0~148^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ea7477ad1b8dc4beb0fab0d8084cd3199c446a6b;p=collectd.git madwifi plugin: fix buffer overflows --- diff --git a/src/madwifi.c b/src/madwifi.c index 949724eb..6eb12dd2 100644 --- a/src/madwifi.c +++ b/src/madwifi.c @@ -367,28 +367,28 @@ static int init_state = 0; static inline int item_watched(int i) { assert (i >= 0); - assert (((size_t) i) < ((STATIC_ARRAY_SIZE (watch_items) + 1) * 32)); + assert ((size_t) i < (STATIC_ARRAY_SIZE (watch_items) * 32)); return watch_items[i / 32] & FLAG (i); } static inline int item_summed(int i) { assert (i >= 0); - assert (((size_t) i) < ((STATIC_ARRAY_SIZE (misc_items) + 1) * 32)); + assert ((size_t) i < (STATIC_ARRAY_SIZE (misc_items) * 32)); return misc_items[i / 32] & FLAG (i); } static inline void watchlist_add (uint32_t *wl, int item) { assert (item >= 0); - assert (item < ((WL_LEN + 1) * 32)); + assert (item < WL_LEN * 32); wl[item / 32] |= FLAG (item); } static inline void watchlist_remove (uint32_t *wl, int item) { assert (item >= 0); - assert (item < ((WL_LEN + 1) * 32)); + assert (item < WL_LEN * 32); wl[item / 32] &= ~FLAG (item); }