aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-11-03 18:01:50 (GMT)
committerJouni Malinen <j@w1.fi>2013-11-03 18:01:50 (GMT)
commit2fe210cebbb589179129af8bf7d0deed73789658 (patch)
tree8e71b7f98c928b34d782ef21c2be9e92870b4987 /hostapd
parente4ba031531964df002312d4ad8674b6d03731e0f (diff)
downloadhostap-2fe210cebbb589179129af8bf7d0deed73789658.zip
hostap-2fe210cebbb589179129af8bf7d0deed73789658.tar.gz
hostap-2fe210cebbb589179129af8bf7d0deed73789658.tar.bz2
hostapd: Fix multi-BSS configuration file parsing regression
Commit ebd79f07c47b02b71c0ac7744a6a94a2bae92fcf broke parsing of configuration files that use the bss parameter to specify another BSS entry. This resulted in crashing the process with NULL pointer dereference since the new hostapd_config::bss design requires this function to allocate a new hostapd_bss_config structure. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'hostapd')
-rw-r--r--hostapd/config_file.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 501aa4a..ef0d647 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -762,16 +762,18 @@ static int hostapd_config_bss(struct hostapd_config *conf, const char *ifname)
}
conf->bss = all;
- bss = conf->bss[conf->num_bss];
- os_memset(bss, 0, sizeof(*bss));
+ bss = os_zalloc(sizeof(*bss));
+ if (bss == NULL)
+ return -1;
bss->radius = os_zalloc(sizeof(*bss->radius));
if (bss->radius == NULL) {
wpa_printf(MSG_ERROR, "Failed to allocate memory for "
"multi-BSS RADIUS data");
+ os_free(bss);
return -1;
}
- conf->num_bss++;
+ conf->bss[conf->num_bss++] = bss;
conf->last_bss = bss;
hostapd_config_defaults_bss(bss);