WPS: add null-terminator to ssid

Jouni Malinen j at w1.fi
Wed Nov 22 09:44:01 PST 2023


On Thu, Nov 16, 2023 at 12:54:15PM +0300, Alexander Pogudaev wrote:
> diff --git a/wpa_supplicant/wps_supplicant.c
> +++ b/wpa_supplicant/wps_supplicant.c
> -	ssid->ssid = os_malloc(cred->ssid_len);
> +	ssid->ssid = os_malloc(cred->ssid_len + 1);
>  	if (ssid->ssid) {
>  		os_memcpy(ssid->ssid, cred->ssid, cred->ssid_len);
> +		ssid->ssid[cred->ssid_len] = '\0';
>  		ssid->ssid_len = cred->ssid_len;
>  	}

Could you please clarify (in the commit message) why this would be
needed?

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list