hostapd: fix a null pointer dereference in wpa_supplicant on teardown
authorFelix Fietkau <nbd@nbd.name>
Wed, 1 May 2024 16:57:00 +0000 (18:57 +0200)
committerFelix Fietkau <nbd@nbd.name>
Wed, 1 May 2024 17:00:21 +0000 (19:00 +0200)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/network/services/hostapd/patches/052-AP-add-missing-null-pointer-check-in-hostapd_free_ha.patch [new file with mode: 0644]

diff --git a/package/network/services/hostapd/patches/052-AP-add-missing-null-pointer-check-in-hostapd_free_ha.patch b/package/network/services/hostapd/patches/052-AP-add-missing-null-pointer-check-in-hostapd_free_ha.patch
new file mode 100644 (file)
index 0000000..85d5127
--- /dev/null
@@ -0,0 +1,20 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Wed, 1 May 2024 18:55:24 +0200
+Subject: [PATCH] AP: add missing null pointer check in hostapd_free_hapd_data
+
+When called from wpa_supplicant, iface->interfaces can be NULL
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/src/ap/hostapd.c
++++ b/src/ap/hostapd.c
+@@ -502,7 +502,7 @@ void hostapd_free_hapd_data(struct hosta
+               struct hapd_interfaces *ifaces = hapd->iface->interfaces;
+               size_t i;
+-              for (i = 0; i < ifaces->count; i++) {
++              for (i = 0; ifaces && i < ifaces->count; i++) {
+                       struct hostapd_iface *iface = ifaces->iface[i];
+                       size_t j;