]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Avoid crashing on station mode disassoc event
authorJouni Malinen <jouni.malinen@atheros.com>
Fri, 22 Oct 2010 14:43:23 +0000 (17:43 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 22 Oct 2010 14:43:23 +0000 (17:43 +0300)
Some driver wrappers may end up indicating a disassociation or
deauthentication event without the address of the station, e.g.,
based on a previous non-AP mode event. Avoid crashing hostapd
by verifying that the require address parameter is available in
the event before processing it.

src/ap/drv_callbacks.c

index 8b354494e74c2fb9ed58094a5c3566b9e1adb67c..7b6e92768f77a300d2d7e10e18b87c19026dd437 100644 (file)
@@ -195,6 +195,19 @@ void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr)
 {
        struct sta_info *sta;
 
+       if (addr == NULL) {
+               /*
+                * This could potentially happen with unexpected event from the
+                * driver wrapper. This was seen at least in one case where the
+                * driver ended up reporting a station mode event while hostapd
+                * was running, so better make sure we stop processing such an
+                * event here.
+                */
+               wpa_printf(MSG_DEBUG, "hostapd_notif_disassoc: Skip event "
+                          "with no address");
+               return -1;
+       }
+
        hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
                       HOSTAPD_LEVEL_INFO, "disassociated");