P2P: Use cleaner way of generating pointer to a field (CID 68095)
The Action code field is in a fixed location, so the IEEE80211_HDRLEN can be used here to clean up bounds checking to avoid false reports from static analyzer. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
e987c70c85
commit
35c03184df
1 changed files with 3 additions and 5 deletions
|
@ -373,18 +373,16 @@ static void ap_public_action_rx(void *ctx, const u8 *buf, size_t len, int freq)
|
||||||
#ifdef CONFIG_P2P
|
#ifdef CONFIG_P2P
|
||||||
struct wpa_supplicant *wpa_s = ctx;
|
struct wpa_supplicant *wpa_s = ctx;
|
||||||
const struct ieee80211_mgmt *mgmt;
|
const struct ieee80211_mgmt *mgmt;
|
||||||
size_t hdr_len;
|
|
||||||
|
|
||||||
mgmt = (const struct ieee80211_mgmt *) buf;
|
mgmt = (const struct ieee80211_mgmt *) buf;
|
||||||
hdr_len = (const u8 *) &mgmt->u.action.u.vs_public_action.action - buf;
|
if (len < IEEE80211_HDRLEN + 1)
|
||||||
if (hdr_len > len)
|
|
||||||
return;
|
return;
|
||||||
if (mgmt->u.action.category != WLAN_ACTION_PUBLIC)
|
if (mgmt->u.action.category != WLAN_ACTION_PUBLIC)
|
||||||
return;
|
return;
|
||||||
wpas_p2p_rx_action(wpa_s, mgmt->da, mgmt->sa, mgmt->bssid,
|
wpas_p2p_rx_action(wpa_s, mgmt->da, mgmt->sa, mgmt->bssid,
|
||||||
mgmt->u.action.category,
|
mgmt->u.action.category,
|
||||||
&mgmt->u.action.u.vs_public_action.action,
|
buf + IEEE80211_HDRLEN + 1,
|
||||||
len - hdr_len, freq);
|
len - IEEE80211_HDRLEN - 1, freq);
|
||||||
#endif /* CONFIG_P2P */
|
#endif /* CONFIG_P2P */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue