From: Jouni Malinen Date: Mon, 22 Jan 2024 19:58:06 +0000 (+0200) Subject: ACS: More consistent checking of the best channel pointer X-Git-Tag: hostap_2_11~431 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=348c047afd7b3735550b9640b6230e9555435427;p=thirdparty%2Fhostap.git ACS: More consistent checking of the best channel pointer It looks like best might be NULL in some cases, so check for this explicitly before trying to dereference it for a debug print. Fixes: 733de85680a4 ("ACS: Fix not selecting the best channel in the segment") Signed-off-by: Jouni Malinen --- diff --git a/src/ap/acs.c b/src/ap/acs.c index 7da95d6c2..28b0ba71c 100644 --- a/src/ap/acs.c +++ b/src/ap/acs.c @@ -963,7 +963,7 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, * crowded primary channel if one was found in the segment */ if (iface->current_mode && iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A && - chan != best) { + best && chan != best) { wpa_printf(MSG_DEBUG, "ACS: promoting channel %d over %d (less interference %Lg/%Lg)", best->chan, chan->chan,