wpa_config_get_line can badly parse a password with # and "

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Here is a password that wpa_config_get_line fails to parse
sae_password="0Y11D#E$4C"P/A;A4D#2x6D""

I made an example with several password on https://onlinegdb.com/9YFBl7Zba
By patch in this example I mentionned patch from xinpeng wang
(sha:aca4d4963a65e49614ed8cd52836a2619775c1f6)

I suggest to revert the patch and to not allow " in comment #
I didn't find any pattern that match my password and what xinpeng wang
wanted (a=b #"abc")

I attach a patch that revert xinpeng wang patch.

What do you think?
Feel free to include my patch, I'm not used to send patch as email

Thanks,
-- 
Baptiste
diff --git a/src/utils/config.c b/src/utils/config.c
index ba26c2c..22aa221 100644
--- a/src/utils/config.c
+++ b/src/utils/config.c
@@ -66,20 +66,12 @@ char * wpa_config_get_line(char *s, int size, FILE *stream, int *line,
 		 * Remove # comments unless they are within a double quoted
 		 * string.
 		 */
-		sstart = pos;
+		sstart = os_strchr(pos, '"');
+		if (sstart)
+			sstart = os_strrchr(sstart + 1, '"');
+		if (!sstart)
+			sstart = pos;
 		end = os_strchr(sstart, '#');
-		while (end) {
-			sstart = os_strchr(sstart, '"');
-			if (!sstart || sstart > end)
-				break;
-			sstart = os_strchr(sstart + 1, '"');
-			if (!sstart)
-				break;
-			sstart++;
-			if (sstart > end)
-				end = os_strchr(sstart, '#');
-		}
-
 		if (end)
 			*end-- = '\0';
 		else
_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap

[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux