hostapd: add missing NULL pointer check in uc_hostapd_iface_stop
authorFelix Fietkau <nbd@nbd.name>
Wed, 20 Sep 2023 16:40:17 +0000 (18:40 +0200)
committerFelix Fietkau <nbd@nbd.name>
Wed, 20 Sep 2023 16:43:35 +0000 (18:43 +0200)
Avoid crashing if the interface has already been removed

Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit 4145ff4d8a29c1c7a1569bb06fa4d1fe9808c94f)

package/network/services/hostapd/src/src/ap/ucode.c

index e79f2420c07a0af702b3317aa160e28bce71c45f..ac3222b03f80dd5e9638488bd5424fde63904cb0 100644 (file)
@@ -471,6 +471,9 @@ uc_hostapd_iface_stop(uc_vm_t *vm, size_t nargs)
        struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface");
        int i;
 
+       if (!iface)
+               return NULL;
+
        switch (iface->state) {
        case HAPD_IFACE_ENABLED:
        case HAPD_IFACE_DISABLED: