aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/ap.c
diff options
context:
space:
mode:
authorSzymon Bigos <szymon.bigos@tieto.com>2011-12-02 21:04:39 (GMT)
committerJouni Malinen <j@w1.fi>2011-12-02 21:04:39 (GMT)
commit9337e876ab677facc850f4db682a7a8d9aed018c (patch)
treed3ac24a7bae16be116a1ebea59dadd46e918406f /wpa_supplicant/ap.c
parent47662f4017b32e17343e5def5f5f55f782b82845 (diff)
downloadhostap-9337e876ab677facc850f4db682a7a8d9aed018c.zip
hostap-9337e876ab677facc850f4db682a7a8d9aed018c.tar.gz
hostap-9337e876ab677facc850f4db682a7a8d9aed018c.tar.bz2
Fix generated WPS PIN values to use zero-padding
The dynamically generated PINs are supposed to have 8 digits, but some PIN generatation cases were not zero-padding these properly.
Diffstat (limited to 'wpa_supplicant/ap.c')
-rw-r--r--wpa_supplicant/ap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index db0259d..4d186b9 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -711,7 +711,7 @@ int wpa_supplicant_ap_wps_pin(struct wpa_supplicant *wpa_s, const u8 *bssid,
if (pin == NULL) {
unsigned int rpin = wps_generate_pin();
- ret_len = os_snprintf(buf, buflen, "%d", rpin);
+ ret_len = os_snprintf(buf, buflen, "%08d", rpin);
pin = buf;
} else
ret_len = os_snprintf(buf, buflen, "%s", pin);
@@ -772,7 +772,7 @@ const char * wpas_wps_ap_pin_random(struct wpa_supplicant *wpa_s, int timeout)
return NULL;
hapd = wpa_s->ap_iface->bss[0];
pin = wps_generate_pin();
- os_snprintf(pin_txt, sizeof(pin_txt), "%u", pin);
+ os_snprintf(pin_txt, sizeof(pin_txt), "%08u", pin);
os_free(hapd->conf->ap_pin);
hapd->conf->ap_pin = os_strdup(pin_txt);
if (hapd->conf->ap_pin == NULL)