Fix wpa_supplicant AP mode with WPS not to crash
authorJouni Malinen <jouni.malinen@atheros.com>
Wed, 6 Oct 2010 13:46:43 +0000 (16:46 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 6 Oct 2010 13:46:43 +0000 (16:46 +0300)
Commit 3379a3a795803335b3f464f34a15f06843369fb1 added a direct
iface->for_each_interface use without verification whether the
function is available. This works with hostapd, but not
wpa_supplicant (which crashes on segfault).

src/ap/wps_hostapd.c

index 7963d60..0b9c2af 100644 (file)
@@ -540,6 +540,8 @@ static int count_interface_cb(struct hostapd_iface *iface, void *ctx)
 static int interface_count(struct hostapd_iface *iface)
 {
        int count = 0;
+       if (iface->for_each_interface == NULL)
+               return 0;
        iface->for_each_interface(iface->interfaces, count_interface_cb,
                                  &count);
        return count;