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

Jouni Malinen j
Fri Dec 9 08:00:58 PST 2011

On Fri, Dec 09, 2011 at 01:10:10PM +0800, jungwalk at gmail.com wrote:
> 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.

Are you trying to fix a bug that addresses some noticeable issue?

> @@ -318,6 +318,7 @@ static int hapd_wps_cred_cb(struct hostapd_data *hapd, void *ctx)
> +	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;

Like Johannes pointed out, this should not really result in any real
change in actual behavior. If it does, there is likely a real bug
somewhere else and that should be fixed. The SSID buffer is used as an
arbitrary binary array of ssid_len octets and as such, there is no need
to null-terminate it - the extra octets in the buffer are ignored.

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list