WPS: Use strict validation of (Re)AssocReq only if IEs are known

This commit is contained in:
Jouni Malinen 2011-04-14 02:58:35 +03:00 committed by Jouni Malinen
parent 5dac11e027
commit 6e432d3f10

View file

@ -157,17 +157,20 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
} }
} else if (hapd->conf->wps_state) { } else if (hapd->conf->wps_state) {
#ifdef CONFIG_WPS_STRICT #ifdef CONFIG_WPS_STRICT
struct wpabuf *wps; if (ie) {
wps = ieee802_11_vendor_ie_concat(ie, ielen, struct wpabuf *wps;
WPS_IE_VENDOR_TYPE); wps = ieee802_11_vendor_ie_concat(ie, ielen,
if (wps && wps_validate_assoc_req(wps) < 0) { WPS_IE_VENDOR_TYPE);
hostapd_drv_sta_disassoc(hapd, sta->addr, if (wps && wps_validate_assoc_req(wps) < 0) {
WLAN_REASON_INVALID_IE); hostapd_drv_sta_disassoc(
ap_free_sta(hapd, sta); hapd, sta->addr,
WLAN_REASON_INVALID_IE);
ap_free_sta(hapd, sta);
wpabuf_free(wps);
return -1;
}
wpabuf_free(wps); wpabuf_free(wps);
return -1;
} }
wpabuf_free(wps);
#endif /* CONFIG_WPS_STRICT */ #endif /* CONFIG_WPS_STRICT */
if (ie && ielen > 4 && ie[0] == 0xdd && ie[1] >= 4 && if (ie && ielen > 4 && ie[0] == 0xdd && ie[1] >= 4 &&
os_memcmp(ie + 2, "\x00\x50\xf2\x04", 4) == 0) { os_memcmp(ie + 2, "\x00\x50\xf2\x04", 4) == 0) {