From 778d87054e6925e1beb9a0c07170cdd990fd7c65 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 12 Dec 2017 00:42:40 +0200 Subject: [PATCH] Fix error handling in bss_load_update_period parser Do not update the configuration parameter before having verified the value to be in the valid range. Signed-off-by: Jouni Malinen --- hostapd/config_file.c | 9 +++++---- src/ap/ap_config.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hostapd/config_file.c b/hostapd/config_file.c index 4e9ace1d8..f1e84b7c9 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -2854,14 +2854,15 @@ static int hostapd_config_fill(struct hostapd_config *conf, } bss->dtim_period = val; } else if (os_strcmp(buf, "bss_load_update_period") == 0) { - bss->bss_load_update_period = atoi(pos); - if (bss->bss_load_update_period < 0 || - bss->bss_load_update_period > 100) { + int val = atoi(pos); + + if (val < 0 || val > 100) { wpa_printf(MSG_ERROR, "Line %d: invalid bss_load_update_period %d", - line, bss->bss_load_update_period); + line, val); return 1; } + bss->bss_load_update_period = val; } else if (os_strcmp(buf, "rts_threshold") == 0) { conf->rts_threshold = atoi(pos); if (conf->rts_threshold < -1 || conf->rts_threshold > 65535) { diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index caf2e3295..fa99d3750 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -248,7 +248,7 @@ struct hostapd_bss_config { int max_num_sta; /* maximum number of STAs in station table */ int dtim_period; - int bss_load_update_period; + unsigned int bss_load_update_period; int ieee802_1x; /* use IEEE 802.1X */ int eapol_version;