]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Fix error handling in bss_load_update_period parser
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 11 Dec 2017 22:42:40 +0000 (00:42 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 11 Dec 2017 22:46:21 +0000 (00:46 +0200)
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>
hostapd/config_file.c
src/ap/ap_config.h

index 4e9ace1d8a68104b4ea8323225075a2e99891a25..f1e84b7c9bcdd33490ce0ff8bacb57f157f65a67 100644 (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) {
index caf2e3295aacf12cc8367e1cfb323973af4aaaed..fa99d37500394d55cf2f930cb4c84cf36674c868 100644 (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;