mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-01-29 08:14:02 -05:00
WNM: Use a clearer validation step for key_len_total
The previous one based on pointer arithmetic was apparently too much for some static analyzers (CID 68130). Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
76874379d3
commit
fecc09edc3
@ -245,6 +245,7 @@ static void ieee802_11_rx_wnmsleep_resp(struct wpa_supplicant *wpa_s,
|
|||||||
/* multiple TFS Resp IE (assuming consecutive) */
|
/* multiple TFS Resp IE (assuming consecutive) */
|
||||||
u8 *tfsresp_ie_start = NULL;
|
u8 *tfsresp_ie_start = NULL;
|
||||||
u8 *tfsresp_ie_end = NULL;
|
u8 *tfsresp_ie_end = NULL;
|
||||||
|
size_t left;
|
||||||
|
|
||||||
if (len < 3)
|
if (len < 3)
|
||||||
return;
|
return;
|
||||||
@ -252,11 +253,12 @@ static void ieee802_11_rx_wnmsleep_resp(struct wpa_supplicant *wpa_s,
|
|||||||
|
|
||||||
wpa_printf(MSG_DEBUG, "WNM-Sleep Mode Response token=%u key_len_total=%d",
|
wpa_printf(MSG_DEBUG, "WNM-Sleep Mode Response token=%u key_len_total=%d",
|
||||||
frm[0], key_len_total);
|
frm[0], key_len_total);
|
||||||
pos += 3 + key_len_total;
|
left = len - 3;
|
||||||
if (pos > frm + len) {
|
if (key_len_total > left) {
|
||||||
wpa_printf(MSG_INFO, "WNM: Too short frame for Key Data field");
|
wpa_printf(MSG_INFO, "WNM: Too short frame for Key Data field");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
pos += 3 + key_len_total;
|
||||||
while (pos - frm < len) {
|
while (pos - frm < len) {
|
||||||
u8 ie_len = *(pos + 1);
|
u8 ie_len = *(pos + 1);
|
||||||
if (pos + 2 + ie_len > frm + len) {
|
if (pos + 2 + ie_len > frm + len) {
|
||||||
|
Loading…
Reference in New Issue
Block a user