aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/ap.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2014-06-12 17:13:50 (GMT)
committerJouni Malinen <j@w1.fi>2014-06-12 21:27:15 (GMT)
commit35c03184dfa060b5b4043a82f16357334beb1066 (patch)
tree2bc62e317f7e5a4216c4a6d5662c6f26fc26d1f5 /wpa_supplicant/ap.c
parente987c70c85b859fbd9fab6a194579a28f235e3af (diff)
downloadhostap-35c03184dfa060b5b4043a82f16357334beb1066.zip
hostap-35c03184dfa060b5b4043a82f16357334beb1066.tar.gz
hostap-35c03184dfa060b5b4043a82f16357334beb1066.tar.bz2
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>
Diffstat (limited to 'wpa_supplicant/ap.c')
-rw-r--r--wpa_supplicant/ap.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index b02c424..92fe7fe 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -373,18 +373,16 @@ static void ap_public_action_rx(void *ctx, const u8 *buf, size_t len, int freq)
#ifdef CONFIG_P2P
struct wpa_supplicant *wpa_s = ctx;
const struct ieee80211_mgmt *mgmt;
- size_t hdr_len;
mgmt = (const struct ieee80211_mgmt *) buf;
- hdr_len = (const u8 *) &mgmt->u.action.u.vs_public_action.action - buf;
- if (hdr_len > len)
+ if (len < IEEE80211_HDRLEN + 1)
return;
if (mgmt->u.action.category != WLAN_ACTION_PUBLIC)
return;
wpas_p2p_rx_action(wpa_s, mgmt->da, mgmt->sa, mgmt->bssid,
mgmt->u.action.category,
- &mgmt->u.action.u.vs_public_action.action,
- len - hdr_len, freq);
+ buf + IEEE80211_HDRLEN + 1,
+ len - IEEE80211_HDRLEN - 1, freq);
#endif /* CONFIG_P2P */
}