[PATCH] hostapd: fix interfaces.iface initialization

Guy Eilam guy
Tue Apr 12 01:45:42 PDT 2011


Set all the interfaces.iface pointers to NULL after
the allocation of that memory block for cases those
pointers are accessed during each of the interfaces
initialization process (hostapd_interface_init()).
One example for such case is during WPS initialization when
the code tries to fetch the uuid from each of the interfaces.

Signed-off-by: Guy Eilam <guy at wizery.com>
---
 hostapd/main.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/hostapd/main.c b/hostapd/main.c
index 94cdbba..d954bc9 100644
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -554,6 +554,14 @@ int main(int argc, char *argv[])
 		return -1;
 	}
 
+	/*
+	 * interfaces.iface pointers should first be initialized to NULL
+	 * for cases that use hostapd_for_each_interface during
+	 * the interface initialization process
+	 */
+	os_memset(interfaces.iface, 0,
+		interfaces.count * sizeof(struct hostapd_iface *));
+
 	if (hostapd_global_init(&interfaces))
 		return -1;
 
-- 
1.7.1




More information about the Hostap mailing list