]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Fix error case in NFC password token generation
authorJouni Malinen <j@w1.fi>
Thu, 28 Jun 2012 10:23:58 +0000 (13:23 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 28 Jun 2012 10:23:58 +0000 (13:23 +0300)
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>

wpa_supplicant/wps_supplicant.c

index cd16e21d723464f5d4aac75d8618e345c57697c2..bade09f0b74654811607375ebcad48a553af51de 100644 (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,
                                     wpa_s->conf->wps_nfc_dh_pubkey,
                                     wpa_s->conf->wps_nfc_dev_pw);
-       if (ndef) {
+       if (ndef && ret) {
                struct wpabuf *tmp;
                tmp = ndef_build_wifi(ret);
                wpabuf_free(ret);