]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Check hostapd_mld_get_link_bss() return value for NULL
authorJouni Malinen <j@w1.fi>
Sat, 18 Oct 2025 08:08:10 +0000 (11:08 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 18 Oct 2025 08:08:10 +0000 (11:08 +0300)
Even though this should not really return NULL for a case where a STA
link has already been checked to be valid, it is better to be
consistently checking for the theoretical NULL value from
hostapd_mld_get_link_bss() (if for no other reason, then at least to
silence warnings from static analyzers).

Signed-off-by: Jouni Malinen <j@w1.fi>
src/ap/drv_callbacks.c

index e4d02423bc86596c47d0a561d3098716d29b4e0d..16a15076cfd1126ee4f596f0dbbe3f812ec3b225 100644 (file)
@@ -499,7 +499,7 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
                                continue;
 
                        bss = hostapd_mld_get_link_bss(hapd, link_id);
-                       if (bss != hapd &&
+                       if (bss && bss != hapd &&
                            hostapd_check_acl(bss, addr, NULL) !=
                            HOSTAPD_ACL_ACCEPT) {
                                wpa_printf(MSG_INFO, "STA " MACSTR
@@ -508,7 +508,8 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
                                reason = WLAN_REASON_UNSPECIFIED;
                                goto fail;
                        }
-                       if (hostapd_check_acl(bss, info->peer_addr, NULL) !=
+                       if (bss &&
+                           hostapd_check_acl(bss, info->peer_addr, NULL) !=
                            HOSTAPD_ACL_ACCEPT) {
                                wpa_printf(MSG_INFO, "link addr " MACSTR
                                           " not allowed to connect",