Skip to content

Commit 0a4fcdf

Browse files
authored
Merge pull request #7940 from mcspr/wifi-evt-ssid
Fix WiFi events with 32byte wide SSIDs
2 parents fdc295d + 3ff5731 commit 0a4fcdf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ WiFiEventHandler ESP8266WiFiGenericClass::onStationModeConnected(std::function<v
105105
WiFiEventHandler handler = std::make_shared<WiFiEventHandlerOpaque>(WIFI_EVENT_STAMODE_CONNECTED, [f](System_Event_t* e) {
106106
auto& src = e->event_info.connected;
107107
WiFiEventStationModeConnected dst;
108-
dst.ssid = String(reinterpret_cast<char*>(src.ssid));
108+
dst.ssid.concat(reinterpret_cast<char*>(src.ssid), src.ssid_len);
109109
memcpy(dst.bssid, src.bssid, 6);
110110
dst.channel = src.channel;
111111
f(dst);
@@ -119,7 +119,7 @@ WiFiEventHandler ESP8266WiFiGenericClass::onStationModeDisconnected(std::functio
119119
WiFiEventHandler handler = std::make_shared<WiFiEventHandlerOpaque>(WIFI_EVENT_STAMODE_DISCONNECTED, [f](System_Event_t* e){
120120
auto& src = e->event_info.disconnected;
121121
WiFiEventStationModeDisconnected dst;
122-
dst.ssid = String(reinterpret_cast<char*>(src.ssid));
122+
dst.ssid.concat(reinterpret_cast<char*>(src.ssid), src.ssid_len);
123123
memcpy(dst.bssid, src.bssid, 6);
124124
dst.reason = static_cast<WiFiDisconnectReason>(src.reason);
125125
f(dst);

0 commit comments

Comments
 (0)