qcacld-3.0: Fix potential OOB read in lim_cu_info_from_rnr_per_link_id

Currently while fetching the cu info from rnr, data length is checked only
for max rnr element which leads to possible out-of-bound reads with
invalid information elements.

Add fix to update the data length checks in the while loop to ensure
sufficient bytes are there.

CRs-Fixed: 3754687
Change-Id: I93f2fbc21fc5adfd848ebb27264cc18f7f553438
这个提交包含在:
Krupali Dhanvijay
2024-03-20 10:45:12 +05:30
提交者 Ravindra Konda
父节点 b10bc753f3
当前提交 dd1a568e13

查看文件

@@ -51,7 +51,7 @@ QDF_STATUS lim_cu_info_from_rnr_per_link_id(const uint8_t *rnr,
rnr_end = rnr + rnr[TAG_LEN_POS] + MIN_IE_LEN;
data = rnr + PAYLOAD_START_POS;
while (data < rnr_end) {
while ((data + sizeof(struct neighbor_ap_info_field)) <= rnr_end) {
neighbor_ap_info = (struct neighbor_ap_info_field *)data;
tbtt_count = neighbor_ap_info->tbtt_header.tbtt_info_count;
tbtt_len = neighbor_ap_info->tbtt_header.tbtt_info_length;