aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/config_file.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2018-02-04 10:20:13 (GMT)
committerJouni Malinen <j@w1.fi>2018-02-04 10:20:13 (GMT)
commit3bd35b681689bf46e54c4cc7e3dc8b04542e07d5 (patch)
tree03534ec9eabf72203c7fe141929c2254887c4beb /wpa_supplicant/config_file.c
parent9c5fe742a25d2361b49051aef5b1ed0083494b6c (diff)
downloadhostap-3bd35b681689bf46e54c4cc7e3dc8b04542e07d5.zip
hostap-3bd35b681689bf46e54c4cc7e3dc8b04542e07d5.tar.gz
hostap-3bd35b681689bf46e54c4cc7e3dc8b04542e07d5.tar.bz2
wpa_supplicant: Fix parsing errors on additional config file
If the -I<config> argument is used and the referenced configuration file cannot be parsed, wpa_config_read() ended up freeing the main configuration data structure and that resulted in use of freed memory in such an error case. Fix this by not freeing the main config data and handling the error case in the caller. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/config_file.c')
-rw-r--r--wpa_supplicant/config_file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index bf0ba17..aaee97e 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -464,7 +464,8 @@ struct wpa_config * wpa_config_read(const char *name, struct wpa_config *cfgp)
#ifndef WPA_IGNORE_CONFIG_ERRORS
if (errors) {
- wpa_config_free(config);
+ if (config != cfgp)
+ wpa_config_free(config);
config = NULL;
head = NULL;
}