aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/services/hostapd
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2021-07-12 13:31:04 +0200
committerFelix Fietkau <nbd@nbd.name>2021-07-12 13:34:08 +0200
commit8f7e6db23045b9b4831d10c5bdf29d514a3753c9 (patch)
tree48af862d39933461a372e6160ec13f77a1128cee /package/network/services/hostapd
parentda2c244e8c9f30e4fc5bf77f0800d685e35d1888 (diff)
downloadupstream-8f7e6db23045b9b4831d10c5bdf29d514a3753c9.tar.gz
upstream-8f7e6db23045b9b4831d10c5bdf29d514a3753c9.tar.bz2
upstream-8f7e6db23045b9b4831d10c5bdf29d514a3753c9.zip
hostapd: fix uninitialized stack variable on CSA
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'package/network/services/hostapd')
-rw-r--r--package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch25
1 files changed, 25 insertions, 0 deletions
diff --git a/package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch b/package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch
new file mode 100644
index 0000000000..c7da33f029
--- /dev/null
+++ b/package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch
@@ -0,0 +1,25 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Thu, 8 Jul 2021 16:33:03 +0200
+Subject: [PATCH] hostapd: fix use of uninitialized stack variables
+
+When a CSA is performed on an 80 MHz channel, hostapd_change_config_freq
+unconditionally calls hostapd_set_oper_centr_freq_seg0/1_idx with seg0/1
+filled by ieee80211_freq_to_chan.
+However, if ieee80211_freq_to_chan fails (because the freq is 0 or invalid),
+seg0/1 remains uninitialized and filled with stack garbage, causing errors
+such as "hostapd: 80 MHz: center segment 1 configured"
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/src/ap/hostapd.c
++++ b/src/ap/hostapd.c
+@@ -3431,7 +3431,7 @@ static int hostapd_change_config_freq(st
+ struct hostapd_freq_params *old_params)
+ {
+ int channel;
+- u8 seg0, seg1;
++ u8 seg0 = 0, seg1 = 0;
+ struct hostapd_hw_modes *mode;
+
+ if (!params->channel) {