blob: 8dec325c985bf0b5f506bac56d9a553b979d08a1 [file] [log] [blame]
developer29c4d2d2022-12-26 19:41:22 +08001From: Felix Fietkau <nbd@nbd.name>
2Date: Thu, 8 Jul 2021 16:33:03 +0200
3Subject: [PATCH] hostapd: fix use of uninitialized stack variables
4
5When a CSA is performed on an 80 MHz channel, hostapd_change_config_freq
6unconditionally calls hostapd_set_oper_centr_freq_seg0/1_idx with seg0/1
7filled by ieee80211_freq_to_chan.
8However, if ieee80211_freq_to_chan fails (because the freq is 0 or invalid),
9seg0/1 remains uninitialized and filled with stack garbage, causing errors
10such as "hostapd: 80 MHz: center segment 1 configured"
11
12Signed-off-by: Felix Fietkau <nbd@nbd.name>
13---
14
15--- a/src/ap/hostapd.c
16+++ b/src/ap/hostapd.c
developer8bff6472023-07-17 11:11:44 +080017@@ -3764,7 +3764,7 @@ static int hostapd_change_config_freq(st
developer29c4d2d2022-12-26 19:41:22 +080018 struct hostapd_freq_params *old_params)
19 {
20 int channel;
21- u8 seg0, seg1;
22+ u8 seg0 = 0, seg1 = 0;
23 struct hostapd_hw_modes *mode;
24
25 if (!params->channel) {