hostapd: fix a crash corner case
authorFelix Fietkau <nbd@nbd.name>
Wed, 10 Apr 2024 11:46:40 +0000 (13:46 +0200)
committerFelix Fietkau <nbd@nbd.name>
Sat, 13 Apr 2024 14:33:45 +0000 (16:33 +0200)
On some setup failures, iface->bss can be NULL

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/network/services/hostapd/src/src/ap/ucode.c

index 16d1b5153607b07dde0b44a411c11291004b22c5..d3441902086ebcaeb196c0096a54db981221f4a0 100644 (file)
@@ -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);