Add explicit buffer length checks for p2p_build_wps_ie()

Even though the length of this buffer is based only on locally
configured information, it is cleaner to include explicit buffer room
validation steps when adding the attributes into the buffer.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-10-26 12:54:20 +03:00
parent 0f0120148a
commit 3318376101
5 changed files with 75 additions and 24 deletions

View file

@ -1911,7 +1911,11 @@ struct wpabuf * p2p_build_probe_resp_ies(struct p2p_data *p2p)
pw_id = p2p_wps_method_pw_id(p2p->go_neg_peer->wps_method);
}
p2p_build_wps_ie(p2p, buf, pw_id, 1);
if (p2p_build_wps_ie(p2p, buf, pw_id, 1) < 0) {
p2p_dbg(p2p, "Failed to build WPS IE for Probe Response");
wpabuf_free(buf);
return NULL;
}
#ifdef CONFIG_WIFI_DISPLAY
if (p2p->wfd_ie_probe_resp)