From 5ae3e836f9de6f3e850f8ead43e9e357475121af Mon Sep 17 00:00:00 2001 From: Maurin Date: Thu, 10 Jun 2021 12:19:58 +0200 Subject: [PATCH] Fix wrong password same SSID (#5124) When iterating through APlist from first to the last element, a corrected password for already known SSID is not used. Therefore, I propose to iterate from the back of the list. With iterating from the back through the vector, an already known SSID with a corrected password is used instead. --- libraries/WiFi/src/WiFiMulti.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/WiFi/src/WiFiMulti.cpp b/libraries/WiFi/src/WiFiMulti.cpp index b821c099..3d69e481 100644 --- a/libraries/WiFi/src/WiFiMulti.cpp +++ b/libraries/WiFi/src/WiFiMulti.cpp @@ -128,8 +128,8 @@ uint8_t WiFiMulti::run(uint32_t connectTimeout) WiFi.getNetworkInfo(i, ssid_scan, sec_scan, rssi_scan, BSSID_scan, chan_scan); bool known = false; - for(uint32_t x = 0; x < APlist.size(); x++) { - WifiAPlist_t entry = APlist[x]; + for(uint32_t x = APlist.size() ; x > 0; x--) { + WifiAPlist_t entry = APlist[x-1]; if(ssid_scan == entry.ssid) { // SSID match known = true;