diff --git a/components/mlme/core/src/wlan_mlme_main.c b/components/mlme/core/src/wlan_mlme_main.c index ed97f44601e1..db02ae773a71 100644 --- a/components/mlme/core/src/wlan_mlme_main.c +++ b/components/mlme/core/src/wlan_mlme_main.c @@ -1236,7 +1236,7 @@ mlme_is_freq_present_in_list(struct acs_weight *normalize_weight_chan_list, { uint8_t i; - for (i = 0; i < num_freq; i++) { + for (i = 0; i < num_freq && i < NUM_CHANNELS; i++) { if (normalize_weight_chan_list[i].chan_freq == freq) { *index = i; return true; @@ -1292,7 +1292,7 @@ mlme_acs_parse_weight_list(struct wlan_objmgr_psoc *psoc, } else { sscanf(str1, "%d", &freq1); strsep(&str1, "="); - if (!str1) + if (!str1 || !weight_list) goto end; sscanf(str1, "%d", &normalize_factor); if (mlme_is_freq_present_in_list(weight_list,