summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a80b4a7)
raw | patch | inline | side by side (parent: a80b4a7)
author | Florian Forster <sifnfors@informatik.stud.uni-erlangen.de> | |
Tue, 11 Aug 2009 14:29:28 +0000 (16:29 +0200) | ||
committer | Florian Forster <sifnfors@informatik.stud.uni-erlangen.de> | |
Tue, 11 Aug 2009 14:29:28 +0000 (16:29 +0200) |
… to otherwise unchecked array indices.
src/madwifi.c | patch | blob | history |
diff --git a/src/madwifi.c b/src/madwifi.c
index 8538f685ef1e55f0c1c864d39804c205672038df..9d973ec059a94335ca42477a8791d3dd9ef27a8c 100644 (file)
--- a/src/madwifi.c
+++ b/src/madwifi.c
static inline int item_watched(int i)
{
+ assert (i >= 0);
+ assert (i < ((STATIC_ARRAY_SIZE (watch_items) + 1) * 32));
return watch_items[i / 32] & FLAG (i);
}
static inline int item_summed(int i)
{
+ assert (i >= 0);
+ assert (i < ((STATIC_ARRAY_SIZE (misc_items) + 1) * 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));
wl[item / 32] |= FLAG (item);
}
static inline void watchlist_remove (uint32_t *wl, int item)
{
+ assert (item >= 0);
+ assert (item < ((WL_LEN + 1) * 32));
wl[item / 32] &= ~FLAG (item);
}
@@ -609,6 +617,9 @@ process_stat_struct (int which, const void *ptr, const char *dev, const char *ma
uint32_t misc = 0;
int i;
+ assert (which >= 1);
+ assert (which < STATIC_ARRAY_SIZE (bounds));
+
for (i = bounds[which - 1]; i < bounds[which]; i++)
{
uint32_t val = *(uint32_t *)(((char *) ptr) + specs[i].offset) ;