From: Felix Fietkau Date: Wed, 10 Apr 2024 11:46:40 +0000 (+0200) Subject: hostapd: fix a crash corner case X-Git-Tag: v6.1-20240716~12 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a8e103c998b2f6ae1516513dcc8e5fa79c0829a6;p=librecmc%2Flibrecmc.git hostapd: fix a crash corner case On some setup failures, iface->bss can be NULL Signed-off-by: Felix Fietkau (cherry picked from commit 1ee5b7e506f937e16737472eed02bc5409716304) Link: https://github.com/openwrt/openwrt/pull/15898 Signed-off-by: Hauke Mehrtens --- 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);