浏览代码

qcacmn: Fix possible OOB read in extract_reg_cap_service_ready_ext_tlv

OOB read can occur while handling WMI_SERVICE_READY_EXT_EVENTID event
when large invalid num_phy received in that event, as this value is used
as index to array.

Change-Id: I0e80d04d19160e219028b07599a8b9953a798fb2
CRs-Fixed: 2374726
Arif Hussain 6 年之前
父节点
当前提交
2028c7f543
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      wmi/src/wmi_unified_tlv.c

+ 3 - 0
wmi/src/wmi_unified_tlv.c

@@ -9337,6 +9337,9 @@ static QDF_STATUS extract_reg_cap_service_ready_ext_tlv(
 	if (!reg_caps)
 		return QDF_STATUS_E_INVAL;
 
+	if (reg_caps->num_phy > param_buf->num_hal_reg_caps)
+		return QDF_STATUS_E_INVAL;
+
 	if (phy_idx >= reg_caps->num_phy)
 		return QDF_STATUS_E_INVAL;