[PATCH] Fixed the array out of bound for pref_freq_list in wpas_p2p_setup_freqs() function

Amit Purwar amit.purwar at samsung.com
Fri Dec 9 05:25:59 PST 2016


Signed-off-by: Amit Purwar <amit.purwar at samsung.com>
Signed-off-by: Mayank Haarit <mayank.h at samsung.com>
---
 wpa_supplicant/p2p_supplicant.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 2da92bf..afbb5b4 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -5239,11 +5239,10 @@ static int wpas_p2p_setup_freqs(struct wpa_supplicant *wpa_s, int freq,
 		if (!res && max_pref_freq > 0) {
 			*num_pref_freq = max_pref_freq;
 			i = 0;
-			while ((!p2p_supported_freq(wpa_s->global->p2p,
+			while (i < *num_pref_freq && (!p2p_supported_freq(wpa_s->global->p2p,
 						    pref_freq_list[i]) ||
 				wpas_p2p_disallowed_freq(wpa_s->global,
-							pref_freq_list[i])) &&
-			       i < *num_pref_freq) {
+							pref_freq_list[i])) ) {
 				wpa_printf(MSG_DEBUG,
 					   "P2P: preferred_freq_list[%d]=%d is disallowed",
 					   i, pref_freq_list[i]);
-- 
1.7.9.5




More information about the Hostap mailing list