From f878ec275d289883ec792702c085e3b885e54dcc Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Thu, 17 Oct 2019 18:00:33 -0500 Subject: [PATCH] scan: Fix logic error in frequency validation The intent here was to validate that the frequency is a multiple of 5 and lies in a certain range. Somehow the channel was checked for being a multiple of 5 instead. --- src/scan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scan.c b/src/scan.c index d279c7e0..a63c462a 100644 --- a/src/scan.c +++ b/src/scan.c @@ -1523,7 +1523,7 @@ uint8_t scan_freq_to_channel(uint32_t freq, enum scan_band *out_band) } if (freq >= 5005 && freq < 5900) { - if (channel % 5) + if (freq % 5) return 0; channel = (freq - 5000) / 5; @@ -1535,7 +1535,7 @@ uint8_t scan_freq_to_channel(uint32_t freq, enum scan_band *out_band) } if (freq >= 4905 && freq < 5000) { - if (channel % 5) + if (freq % 5) return 0; channel = (freq - 4000) / 5;