diag: Avoid possible out of bound access while sending masks

Due to mask size wrongly calculated with incorrect range possible
out of bound access is possible. Prevent the possibility by
correcting the range.

Change-Id: I1b8c50411a6fb17f9ca6e90c0646690953f3db0e
Signed-off-by: Manoj Prabhu B <quic_bmanoj@quicinc.com>
This commit is contained in:
Manoj Prabhu B 2021-12-06 17:10:57 +05:30
parent 2959ed5eb8
commit 1e6a34af1e

View File

@ -1156,7 +1156,7 @@ static int diag_cmd_set_msg_mask(unsigned char *src_buf, int src_len,
mask_size = MAX_SSID_PER_RANGE;
mask->range_tools = MAX_SSID_PER_RANGE;
mask->ssid_last_tools =
mask->ssid_first + mask->range_tools;
mask->ssid_first + mask->range_tools - 1;
}
if (ssid_range.ssid_last > mask->ssid_last_tools) {
pr_debug("diag: Msg SSID range mismatch\n");