From 1560db9f9b2a3d980bff8a4b8d08119c09c434ec Mon Sep 17 00:00:00 2001 From: liqinhui Date: Tue, 24 Oct 2023 20:08:37 +0800 Subject: [PATCH] simwifi: Fix the error of the need length for scanning. The error of estimating the buffer space may cause an out-of-bounds in filling scan results. Signed-off-by: liqinhui --- arch/sim/src/sim/sim_wifidriver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/sim/src/sim/sim_wifidriver.c b/arch/sim/src/sim/sim_wifidriver.c index d345d0c30c..1f68755eed 100644 --- a/arch/sim/src/sim/sim_wifidriver.c +++ b/arch/sim/src/sim/sim_wifidriver.c @@ -430,7 +430,8 @@ static int copy_scan_results(struct sim_scan_result_s *scan_req, struct iw_event *iwe; need_len = IW_EV_LEN(ap_addr) + IW_EV_LEN(qual) + - IW_EV_LEN(freq) + IW_EV_LEN(data) + IW_EV_LEN(essid); + IW_EV_LEN(freq) + IW_EV_LEN(data) + + IW_EV_LEN(essid) + ((MIN(info->ssid_len, 32) + 3) & ~3); if (scan_req->cur_len + need_len > scan_req->total_len) {