]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
ACS: Check whether iface->current_mode is NULL before use
authorJouni Malinen <j@w1.fi>
Sat, 16 Dec 2023 22:02:43 +0000 (00:02 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 16 Dec 2023 22:02:43 +0000 (00:02 +0200)
This line seemed to trigger SIGSEGV in some code coverage testing cases.
It is not exactly clear how that was possible, but just in case, check
that iface->current_mode is set before using it here.

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

index 0ac05b52afdf7bc1490f4ec040cac963146c91ec..7ab310f75a557b1854ec80bc766ad6b0997b6dc8 100644 (file)
@@ -917,7 +917,8 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface,
 
                /* If the AP is in the 5 GHz or 6 GHz band, lets prefer a less
                 * crowded primary channel if one was found in the segment */
-               if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A &&
+               if (iface->current_mode &&
+                   iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A &&
                    chan != best) {
                        wpa_printf(MSG_DEBUG,
                                   "ACS: promoting channel %d over %d (less interference %Lg/%Lg)",