]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Do not update dtim_period with invalid value
authorJouni Malinen <j@w1.fi>
Tue, 27 Dec 2016 10:24:02 +0000 (12:24 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 27 Dec 2016 10:24:02 +0000 (12:24 +0200)
Previously, the update command was rejected, but the actual value was
updated.

Signed-off-by: Jouni Malinen <j@w1.fi>
hostapd/config_file.c

index a115c1efe53f3a19d8ad42abe5ed2008878b014d..8ebdd7b3ba90b92804b29232380e627e2a7ec3a5 100644 (file)
@@ -2750,12 +2750,14 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                }
 #endif /* CONFIG_ACS */
        } else if (os_strcmp(buf, "dtim_period") == 0) {
-               bss->dtim_period = atoi(pos);
-               if (bss->dtim_period < 1 || bss->dtim_period > 255) {
+               int val = atoi(pos);
+
+               if (val < 1 || val > 255) {
                        wpa_printf(MSG_ERROR, "Line %d: invalid dtim_period %d",
-                                  line, bss->dtim_period);
+                                  line, val);
                        return 1;
                }
+               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 ||