BSS: Convert wpa_bss_get_vendor_ie() to use for_each_element_id()
Use the common IE parsing routine in hope of trying to make the length checks easier for static analyzers. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
ec1f4f3c81
commit
56a1df71e5
1 changed files with 7 additions and 10 deletions
|
@ -1154,18 +1154,15 @@ const u8 * wpa_bss_get_ie(const struct wpa_bss *bss, u8 ie)
|
||||||
*/
|
*/
|
||||||
const u8 * wpa_bss_get_vendor_ie(const struct wpa_bss *bss, u32 vendor_type)
|
const u8 * wpa_bss_get_vendor_ie(const struct wpa_bss *bss, u32 vendor_type)
|
||||||
{
|
{
|
||||||
const u8 *end, *pos;
|
const u8 *ies;
|
||||||
|
const struct element *elem;
|
||||||
|
|
||||||
pos = (const u8 *) (bss + 1);
|
ies = (const u8 *) (bss + 1);
|
||||||
end = pos + bss->ie_len;
|
|
||||||
|
|
||||||
while (end - pos > 1) {
|
for_each_element_id(elem, WLAN_EID_VENDOR_SPECIFIC, ies, bss->ie_len) {
|
||||||
if (2 + pos[1] > end - pos)
|
if (elem->datalen >= 4 &&
|
||||||
break;
|
vendor_type == WPA_GET_BE32(elem->data))
|
||||||
if (pos[0] == WLAN_EID_VENDOR_SPECIFIC && pos[1] >= 4 &&
|
return &elem->id;
|
||||||
vendor_type == WPA_GET_BE32(&pos[2]))
|
|
||||||
return pos;
|
|
||||||
pos += 2 + pos[1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in a new issue