P2P: Use offsetof() instead of local implementation

The construction used here to figure out the offset of variable length
IEs in Probe Request frames was a bit odd looking and resulted in a
warning from a static analyzer, so replace it with more standard use of
offsetof().

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-06-23 18:30:11 +03:00
parent c3c5b5fe92
commit c5ca73d1f7

View file

@ -2389,8 +2389,8 @@ p2p_reply_probe(struct p2p_data *p2p, const u8 *addr, const u8 *dst,
return P2P_PREQ_NOT_PROCESSED;
}
resp = NULL;
resp = wpabuf_put(buf, resp->u.probe_resp.variable - (u8 *) resp);
resp = wpabuf_put(buf, offsetof(struct ieee80211_mgmt,
u.probe_resp.variable));
resp->frame_control = host_to_le16((WLAN_FC_TYPE_MGMT << 2) |
(WLAN_FC_STYPE_PROBE_RESP << 4));