[PATCH] Fix segfault in case of invalid configuration
Krishna
chaitanya.mgit at gmail.com
Sun Jan 15 11:58:54 PST 2023
The RO variable is being assigned before the SSID is NULL checked, so,
any invalid configuration leads to a segmentation fault.
Fixes commit d8d2b3a33("Implement read-only mode for SSIDs from the
additional config (-I)").
Signed-off-by: Chaitanya Tata <chaitanya.tk17 at gmail.com>
---
wpa_supplicant/config_file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index 4d50f44a8..2e4b081e9 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -339,13 +339,13 @@ struct wpa_config * wpa_config_read(const char *name, struct wpa_config *cfgp,
while (wpa_config_get_line(buf, sizeof(buf), f, &line, &pos)) {
if (os_strcmp(pos, "network={") == 0) {
ssid = wpa_config_read_network(f, &line, id++);
- ssid->ro = ro;
if (ssid == NULL) {
wpa_printf(MSG_ERROR, "Line %d: failed to "
"parse network block.", line);
errors++;
continue;
}
+ ssid->ro = ro;
if (head == NULL) {
head = tail = ssid;
} else {
--
2.34.1
More information about the Hostap
mailing list