From 65073ffcfa1ef67c4c69d0b697bbcc0e96c138e7 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Thu, 24 Oct 2024 09:46:35 -0700 Subject: [PATCH] util: warn on invalid channels when iterating a frequency set This should not happen but if it does we should alert the user. --- src/util.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/util.c b/src/util.c index 5ce764ae..8c690fc0 100644 --- a/src/util.c +++ b/src/util.c @@ -464,6 +464,11 @@ static void scan_channels_foreach(uint32_t channel, void *user_data) uint32_t freq; freq = band_channel_to_freq(channel, channels_data->band); + if (!freq) { + l_warn("invalid channel %u for band %u", channel, + channels_data->band); + return; + } channels_data->func(freq, channels_data->user_data); }