diff mbox series

nl80211: Fix frequencies array boundary check

Message ID 20230223122306.14037-1-andrei.otcheretianski@intel.com
State Superseded
Headers show
Series nl80211: Fix frequencies array boundary check | expand

Commit Message

Andrei Otcheretianski Feb. 23, 2023, 12:23 p.m. UTC
From: Avraham Stern <avraham.stern@intel.com>

The number of frequencies is increased before the boundary check,
thus it should be allowed to be equal to the number of elements in
the array.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
---
 src/drivers/driver_nl80211_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c
index e3fcb44022..412611dfe2 100644
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -1732,7 +1732,7 @@  static void send_scan_event(struct wpa_driver_nl80211_data *drv, int aborted,
 			if (!os_snprintf_error(end - pos, res))
 				pos += res;
 			num_freqs++;
-			if (num_freqs == MAX_REPORT_FREQS - 1)
+			if (num_freqs == MAX_REPORT_FREQS)
 				break;
 		}
 		info->freqs = freqs;