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 <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2017-12-12 00:42:40 +02:00 committed by Jouni Malinen
parent dff5ab97eb
commit 778d87054e
2 changed files with 6 additions and 5 deletions

View file

@ -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) {

View file

@ -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;