diff options
| author | Masti, Narayanraddi <c_nmasti@qti.qualcomm.com> | 2015-05-09 19:10:24 +0530 |
|---|---|---|
| committer | AnjaneeDevi Kapparapu <c_akappa@qti.qualcomm.com> | 2015-05-19 15:58:25 +0530 |
| commit | 04243ea6740441af4335bfdb50001f728122139c (patch) | |
| tree | 28aef96cbe22bb1370ac46d4d2dd903159a0445b | |
| parent | 954f17a1c1ebcfec1d10bb8e786ee153bf70619b (diff) | |
qcacld-2.0: Fix Array index out of bounds
Fix array index out of bounds by finding minimum
between hdd_ctxt->unsafe_channel_count and
NUM_20MHZ_RF_CHANNELS and setting the value to
the variable
Change-Id: I84bce45c6287d5701b010675daa049cefade2b75
CRs-Fixed: 835214
| -rwxr-xr-x | CORE/HDD/src/wlan_hdd_main.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c index 814ae2726bcf..aa7b022f2d32 100755 --- a/CORE/HDD/src/wlan_hdd_main.c +++ b/CORE/HDD/src/wlan_hdd_main.c @@ -13080,16 +13080,19 @@ static uint8_t hdd_find_prefd_safe_chnl(hdd_context_t *hdd_ctxt, { uint16_t safe_channels[NUM_20MHZ_RF_CHANNELS]; uint16_t safe_channel_count; + uint16_t unsafe_channel_count; uint8_t is_unsafe = 1; uint16_t i; uint16_t channel_loop; safe_channel_count = 0; + unsafe_channel_count = min((uint16_t)hdd_ctxt->unsafe_channel_count, + (uint16_t)NUM_20MHZ_RF_CHANNELS); + for (i = 0; i < NUM_20MHZ_RF_CHANNELS; i++) { is_unsafe = 0; for (channel_loop = 0; - channel_loop < hdd_ctxt->unsafe_channel_count; - channel_loop++) { + channel_loop < unsafe_channel_count; channel_loop++) { if (rfChannels[i].channelNum == hdd_ctxt->unsafe_channel_list[channel_loop]) { is_unsafe = 1; |
