[PATCH] Reset the ssid in wps before being replaced with the one in credential.

jungwalk at gmail.com jungwalk
Thu Dec 8 21:10:10 PST 2011

From: Spencer Chang <jungwalk at gmail.com>

It is better to reset the ssid in WPS first before it is replaced with the one in
credential in case the length of ssid in credential is longer than wps->ssid.

Signed-off-by: Spencer Chang <jungwalk at gmail.com>
 src/ap/wps_hostapd.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c
index 817012e..42b22a2 100644
--- a/src/ap/wps_hostapd.c
+++ b/src/ap/wps_hostapd.c
@@ -318,6 +318,7 @@ static int hapd_wps_cred_cb(struct hostapd_data *hapd, void *ctx)
 	if (hapd->conf->wps_cred_processing == 1)
 		return 0;
+	os_memset(hapd->wps->ssid, 0, HOSTAPD_MAX_SSID_LEN);
 	os_memcpy(hapd->wps->ssid, cred->ssid, cred->ssid_len);
 	hapd->wps->ssid_len = cred->ssid_len;
 	hapd->wps->encr_types = cred->encr_type;

More information about the Hostap mailing list