Fix segfault in case of an invalid configuration
The RO variable is being assigned before the SSID is NULL checked, so,
any invalid configuration leads to a segmentation fault.
Fixes: d8d2b3a338
("Implement read-only mode for SSIDs from the additional config (-I)")
Signed-off-by: Chaitanya Tata <chaitanya.tk17@gmail.com>
This commit is contained in:
parent
825a545279
commit
d31c2b43aa
1 changed files with 1 additions and 1 deletions
|
@ -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)) {
|
while (wpa_config_get_line(buf, sizeof(buf), f, &line, &pos)) {
|
||||||
if (os_strcmp(pos, "network={") == 0) {
|
if (os_strcmp(pos, "network={") == 0) {
|
||||||
ssid = wpa_config_read_network(f, &line, id++);
|
ssid = wpa_config_read_network(f, &line, id++);
|
||||||
ssid->ro = ro;
|
|
||||||
if (ssid == NULL) {
|
if (ssid == NULL) {
|
||||||
wpa_printf(MSG_ERROR, "Line %d: failed to "
|
wpa_printf(MSG_ERROR, "Line %d: failed to "
|
||||||
"parse network block.", line);
|
"parse network block.", line);
|
||||||
errors++;
|
errors++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
ssid->ro = ro;
|
||||||
if (head == NULL) {
|
if (head == NULL) {
|
||||||
head = tail = ssid;
|
head = tail = ssid;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue