From 5b4cf8f7620106336c8025c36384aea9779d5e95 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 20 May 2017 13:03:32 +0200 Subject: [PATCH] wifi: reject WPS PSK secret with non-UTF-8 characters (part 2) We must reject '\0' characters inside the PSK as well. Fixes: ac436dc2c419d6b84ff3187ddfe83e53de168329 --- src/devices/wifi/nm-device-wifi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index dfbf5818e0..6153f5d93c 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -1856,7 +1856,7 @@ supplicant_iface_wps_credentials_cb (NMSupplicantInterface *iface, if (psk_len >= 8 && psk_len <= 63) { memcpy (psk, array, psk_len); psk[psk_len] = '\0'; - if (g_utf8_validate (psk, -1, NULL)) { + if (g_utf8_validate (psk, psk_len, NULL)) { secrets = g_variant_new_parsed ("[{%s, [{%s, <%s>}]}]", NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NM_SETTING_WIRELESS_SECURITY_PSK, psk);