mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-01-19 03:14:05 -05:00
common: Use for_each_element() in ieee802_11_ie_count()
Simple cleanup using the new macros. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
0e0c31bdc5
commit
eb84238df6
@ -543,21 +543,14 @@ ParseRes ieee802_11_parse_elems(const u8 *start, size_t len,
|
|||||||
|
|
||||||
int ieee802_11_ie_count(const u8 *ies, size_t ies_len)
|
int ieee802_11_ie_count(const u8 *ies, size_t ies_len)
|
||||||
{
|
{
|
||||||
|
const struct element *elem;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
const u8 *pos, *end;
|
|
||||||
|
|
||||||
if (ies == NULL)
|
if (ies == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pos = ies;
|
for_each_element(elem, ies, ies_len)
|
||||||
end = ies + ies_len;
|
|
||||||
|
|
||||||
while (end - pos >= 2) {
|
|
||||||
if (2 + pos[1] > end - pos)
|
|
||||||
break;
|
|
||||||
count++;
|
count++;
|
||||||
pos += 2 + pos[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user