[openwrt/openwrt] hostapd: fix a crash corner case

LEDE Commits lede-commits at lists.infradead.org
Mon Jul 8 12:17:38 PDT 2024


hauke pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/d0c7b19db8993c23fc0bd989bef982fc000ea2f2

commit d0c7b19db8993c23fc0bd989bef982fc000ea2f2
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Wed Apr 10 13:46:40 2024 +0200

    hostapd: fix a crash corner case
    
    On some setup failures, iface->bss can be NULL
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
    (cherry picked from commit 1ee5b7e506f937e16737472eed02bc5409716304)
    Link: https://github.com/openwrt/openwrt/pull/15898
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 package/network/services/hostapd/src/src/ap/ucode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c
index 80c01b4b9b..f961b6a097 100644
--- a/package/network/services/hostapd/src/src/ap/ucode.c
+++ b/package/network/services/hostapd/src/src/ap/ucode.c
@@ -51,7 +51,7 @@ hostapd_ucode_update_bss_list(struct hostapd_iface *iface, uc_value_t *if_bss, u
 	int i;
 
 	list = ucv_array_new(vm);
-	for (i = 0; i < iface->num_bss; i++) {
+	for (i = 0; iface->bss && i < iface->num_bss; i++) {
 		struct hostapd_data *hapd = iface->bss[i];
 		uc_value_t *val = hostapd_ucode_bss_get_uval(hapd);
 




More information about the lede-commits mailing list