qcacmn: Fix potential OOB read in util_scan_parse_rnr_ie
Currently, while parsing scan RNR Ie data is moved to next neighbor_ap_info_field after parsing the current neighbor_ap_info_field. But in last iteration pointer may try to access invalid data if (uint8_t *)ie + rnr_ie_len + 2) bytes are less than sizeof neighbor_ap_info_field and same is the case with tbtt_length access. Fix is to add a length check of data + next data size to be parsed < (uint8_t *)ie + rnr_ie_len + 2) instead of adding a validation of data length only. CRs-Fixed: 3710080 Change-Id: I05e5a9a02f0f4f9bc468db894588e676f0a248c0
Dieser Commit ist enthalten in:

committet von
Ravindra Konda

Ursprung
77cebf7083
Commit
d47fccbfde
@@ -1158,7 +1158,8 @@ util_scan_parse_rnr_ie(struct scan_cache_entry *scan_entry,
|
||||
data = (uint8_t *)ie + sizeof(struct ie_header);
|
||||
idx = scan_entry->rnr.count;
|
||||
|
||||
while (data < ((uint8_t *)ie + rnr_ie_len + 2)) {
|
||||
while ((data + sizeof(struct neighbor_ap_info_field)) <
|
||||
((uint8_t *)ie + rnr_ie_len + 2)) {
|
||||
neighbor_ap_info = (struct neighbor_ap_info_field *)data;
|
||||
tbtt_count = neighbor_ap_info->tbtt_header.tbtt_info_count;
|
||||
tbtt_length = neighbor_ap_info->tbtt_header.tbtt_info_length;
|
||||
@@ -1173,7 +1174,8 @@ util_scan_parse_rnr_ie(struct scan_cache_entry *scan_entry,
|
||||
break;
|
||||
|
||||
for (i = 0; i < (tbtt_count + 1) &&
|
||||
data < ((uint8_t *)ie + rnr_ie_len + 2); i++) {
|
||||
(data + tbtt_length) <
|
||||
((uint8_t *)ie + rnr_ie_len + 2); i++) {
|
||||
if ((i < MAX_RNR_BSS) && (idx < MAX_RNR_BSS))
|
||||
util_scan_update_rnr(
|
||||
&scan_entry->rnr.bss_info[idx++],
|
||||
@@ -2905,7 +2907,7 @@ static int util_handle_rnr_ie_for_mbssid(const uint8_t *rnr,
|
||||
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;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren