qcacmn: Validate num_links before accessing data

In util_parse_rv_info_from_linkinfo, accessing the array of data
without validating the index of the array will cause OOB issue.

Add check with the maximum size of the array before accessing the
data.

Change-Id: Ie8b33c83fa1cd18cfbfcb6c7a82b79ddd86e8808
CRs-Fixed: 3580821
This commit is contained in:
Vinod Kumar Myadam
2023-08-10 17:48:43 +05:30
committed by Rahul Choudhary
부모 fcf4ae51f3
커밋 151331ba76

파일 보기

@@ -4523,6 +4523,12 @@ util_parse_rv_info_from_linkinfo(uint8_t *linkinfo,
&ap_removal_timer);
if (QDF_IS_STATUS_ERROR(ret))
return ret;
if (reconfig_info->num_links >=
WLAN_UMAC_MLO_MAX_VDEVS) {
mlo_err("num_link %d invalid",
reconfig_info->num_links);
return QDF_STATUS_E_INVAL;
}
link_info =
&reconfig_info->link_info[reconfig_info->num_links];
link_info->link_id = linkid;