blob: 25801da3349db90302ec481878586ecc2f105dd8 [file] [log] [blame]
developer1ec629b2022-05-09 13:05:53 +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
developer842205d2022-09-22 17:12:54 +080017@@ -3453,7 +3453,7 @@ static int hostapd_change_config_freq(st
developer1ec629b2022-05-09 13:05:53 +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) {