mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-24 16:28:23 -05:00
BSS: Use variable length array for IEs at the end of struct wpa_bss
Replace the previously used design "(u8 *) (bss + 1)" with a variable length array at the end of struct wpa_bss bss->ies[] in hopes of making this easier to understand for static analyzers. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
be7ee264f6
commit
454ebb504c
@ -464,7 +464,7 @@ static struct wpa_bss * wpa_bss_add(struct wpa_supplicant *wpa_s,
|
||||
bss->ssid_len = ssid_len;
|
||||
bss->ie_len = res->ie_len;
|
||||
bss->beacon_ie_len = res->beacon_ie_len;
|
||||
os_memcpy(bss + 1, res + 1, res->ie_len + res->beacon_ie_len);
|
||||
os_memcpy(bss->ies, res + 1, res->ie_len + res->beacon_ie_len);
|
||||
wpa_bss_set_hessid(bss);
|
||||
|
||||
if (wpa_s->num_bss + 1 > wpa_s->conf->bss_max_count &&
|
||||
@ -691,7 +691,7 @@ wpa_bss_update(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
|
||||
#endif /* CONFIG_P2P */
|
||||
if (bss->ie_len + bss->beacon_ie_len >=
|
||||
res->ie_len + res->beacon_ie_len) {
|
||||
os_memcpy(bss + 1, res + 1, res->ie_len + res->beacon_ie_len);
|
||||
os_memcpy(bss->ies, res + 1, res->ie_len + res->beacon_ie_len);
|
||||
bss->ie_len = res->ie_len;
|
||||
bss->beacon_ie_len = res->beacon_ie_len;
|
||||
} else {
|
||||
@ -712,7 +712,7 @@ wpa_bss_update(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
|
||||
wpa_s->current_bss = nbss;
|
||||
wpa_bss_update_pending_connect(wpa_s, bss, nbss);
|
||||
bss = nbss;
|
||||
os_memcpy(bss + 1, res + 1,
|
||||
os_memcpy(bss->ies, res + 1,
|
||||
res->ie_len + res->beacon_ie_len);
|
||||
bss->ie_len = res->ie_len;
|
||||
bss->beacon_ie_len = res->beacon_ie_len;
|
||||
|
@ -111,11 +111,12 @@ struct wpa_bss {
|
||||
size_t beacon_ie_len;
|
||||
/* followed by ie_len octets of IEs */
|
||||
/* followed by beacon_ie_len octets of IEs */
|
||||
u8 ies[];
|
||||
};
|
||||
|
||||
static inline const u8 * wpa_bss_ie_ptr(const struct wpa_bss *bss)
|
||||
{
|
||||
return (const u8 *) (bss + 1);
|
||||
return bss->ies;
|
||||
}
|
||||
|
||||
void wpa_bss_update_start(struct wpa_supplicant *wpa_s);
|
||||
|
Loading…
Reference in New Issue
Block a user