WPS: Fix error case in NFC password token generation

Need to verify that wps_build_nfc_pw_token() returned a valid buffer
before trying to encapsulate it for NDEF.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2012-06-28 13:23:58 +03:00
parent 0e3c16546b
commit 5bb7ae1f0c

View file

@ -1799,7 +1799,7 @@ struct wpabuf * wpas_wps_nfc_token(struct wpa_supplicant *wpa_s, int ndef)
ret = wps_build_nfc_pw_token(wpa_s->conf->wps_nfc_dev_pw_id, ret = wps_build_nfc_pw_token(wpa_s->conf->wps_nfc_dev_pw_id,
wpa_s->conf->wps_nfc_dh_pubkey, wpa_s->conf->wps_nfc_dh_pubkey,
wpa_s->conf->wps_nfc_dev_pw); wpa_s->conf->wps_nfc_dev_pw);
if (ndef) { if (ndef && ret) {
struct wpabuf *tmp; struct wpabuf *tmp;
tmp = ndef_build_wifi(ret); tmp = ndef_build_wifi(ret);
wpabuf_free(ret); wpabuf_free(ret);