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 <liqinhui@xiaomi.com>
This commit is contained in:
liqinhui 2023-10-24 20:08:37 +08:00 committed by Xiang Xiao
parent 881d67272c
commit 1560db9f9b
1 changed files with 2 additions and 1 deletions

View File

@ -430,7 +430,8 @@ static int copy_scan_results(struct sim_scan_result_s *scan_req,
struct iw_event *iwe; struct iw_event *iwe;
need_len = IW_EV_LEN(ap_addr) + IW_EV_LEN(qual) + 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) if (scan_req->cur_len + need_len > scan_req->total_len)
{ {