Skip to contentSkip to conversation

staging: ks7010: parsing bugs in ks_wlan_read_config_file()

PATCH In review Dan Carpenter 2 participants 2 messages Jun 14, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 staging: ks7010: parsing bugs in ks_wlan_read_config_file()

The check for the NUL terminator is wrong so it looks like this could read beyond the end of the buffer.

drivers/staging/ks7010/ks7010_config.c +2 -2
index 4b495cb..fb90012 100644
@@ -358,7 +358,7 @@ int ks_wlan_read_config_file(struct ks_wlan_private *priv)
 					break;
 				wk_p++;
 				for (j = 0; *wk_p != '"'; j++) {
-					if (wk_p = '\0') {
+					if (*wk_p = '\0') {
 						break;
 					}
 					priv->reg.ssid.body[j] = *wk_p++;
@@ -443,7 +443,7 @@ int ks_wlan_read_config_file(struct ks_wlan_private *priv)
 					break;
 				wk_p++;
 				for (j = 0; *wk_p != '"'; j++) {
-					if (wk_p = '\0') {
+					if (*wk_p = '\0') {
 						break;
 					}
 					priv->reg.rom_file[j] = *wk_p++;
#1 lore raw
Quoted 4 lines · Dan Carpenter

The check for the NUL terminator is wrong so it looks like this could read beyond the end of the buffer.

Thanks, however I have a patch very soon to be submitted which removes the config.c file completely.