Skip to content

Commit 68bcc41

Browse files
earlephilhowerdevyte
authored andcommitted
Fix SSID reporting for 32-char SSIDs (esp8266#5889)
Fixes 5853
1 parent d19fc3b commit 68bcc41

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libraries/ESP8266WiFi/src/ESP8266WiFiScan.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ bool ESP8266WiFiScanClass::getNetworkInfo(uint8_t i, String &ssid, uint8_t &encT
165165
return false;
166166
}
167167

168-
ssid = (const char*) it->ssid;
168+
char ssid_copy[33]; // Ensure space for maximum len SSID (32) plus trailing 0
169+
memcpy(ssid_copy, it->ssid, sizeof(it->ssid));
170+
ssid_copy[32] = 0; // Potentially add 0-termination if none present earlier
171+
ssid = (const char*) ssid_copy;
169172
encType = encryptionType(i);
170173
rssi = it->rssi;
171174
bssid = it->bssid; // move ptr

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy