From 2a74a1d231af03d0cfb4c96a047d45b327893f73 Mon Sep 17 00:00:00 2001 From: Utkarsh Bhatnagar Date: Wed, 10 Jun 2020 12:07:25 +0530 Subject: [PATCH] qcacld-3.0: Add check in policy_mgr_dump_channel_list Add check in policy_mgr_dump_channel_list to restrict the pcl_channels array index to NUM_CHANNELS & len while printing 2G/5G and 6G channel list as pcl_channels is initialized with size of NUM_CHANNELS. Change-Id: I5ca573d1c12970974cbb09c5d25f816e2d6c1de5 CRs-Fixed: 2706882 --- components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c index 472d59b9a2b2..a75655ec57da 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c @@ -2486,7 +2486,7 @@ bool policy_mgr_dump_channel_list(uint32_t len, uint32_t *pcl_channels, return false; policymgr_nofl_debug("Total PCL Chan Freq %d", len); - for (idx = 0; idx < len; idx++) { + for (idx = 0; (idx < len) && (idx < NUM_CHANNELS); idx++) { if (!WLAN_REG_IS_6GHZ_CHAN_FREQ(pcl_channels[idx])) { num += qdf_scnprintf(chan_buff + num, buff_len - num, " %d[%d]", pcl_channels[idx], @@ -2512,7 +2512,7 @@ bool policy_mgr_dump_channel_list(uint32_t len, uint32_t *pcl_channels, count = 0; num = 0; - for (idx = 0; idx < len; idx++) { + for (idx = 0; (idx < len) && (idx < NUM_CHANNELS); idx++) { if (WLAN_REG_IS_6GHZ_CHAN_FREQ(pcl_channels[idx])) { num += qdf_scnprintf(chan_buff + num, buff_len - num, " %d[%d]", pcl_channels[idx],