[PATCH] Fix the out of bound memory in pref_freq_list.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In while loop first index of pref_freq_list is checked with size of pref_freq_list and then it is accessed.

Signed-off-by: Amit Purwar <amit.purwar@xxxxxxxxxxx>
Signed-off-by: Mayank Haarit <mayank.h@xxxxxxxxxxx>
---
 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..f485dd9 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -5606,9 +5606,8 @@ static int wpas_p2p_select_go_freq(struct wpa_supplicant *wpa_s, int freq)
 						 &size, pref_freq_list);
 		if (!res && size > 0) {
 			i = 0;
-			while (wpas_p2p_disallowed_freq(wpa_s->global,
-							pref_freq_list[i]) &&
-			       i < size) {
+			while (i < size && wpas_p2p_disallowed_freq(wpa_s->global,
+							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


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux