Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f4d8a48

Browse filesBrowse files
author
Juan Luis Leal Contreras
authored
Fixed espressif#7406 crash on WiFi STA_DISCONNECTED event with reason 0 (espressif#7414)
Fixed espressif#7406 . The "reason2str" macro in WiFiGeneric.cpp tries to read memory from index "-1" in "system_event_reasons" array when handling STA_DISCONNECTED event with reason 0. Dealing with reason 0 as a reason 1 (WIFI_REASON_UNSPECIFIED) will solve the problem (the reason for this event to arrive with reason 0 is unknown). espressif#7406
1 parent 2cebee4 commit f4d8a48
Copy full SHA for f4d8a48

File tree

Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed

‎libraries/WiFi/src/WiFiGeneric.cpp

Copy file name to clipboardExpand all lines: libraries/WiFi/src/WiFiGeneric.cpp
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,9 @@ esp_err_t WiFiGenericClass::_eventCallback(arduino_event_t *event)
947947
//esp_netif_create_ip6_linklocal(esp_netifs[ESP_IF_WIFI_STA]);
948948
} else if(event->event_id == ARDUINO_EVENT_WIFI_STA_DISCONNECTED) {
949949
uint8_t reason = event->event_info.wifi_sta_disconnected.reason;
950+
// Reason 0 causes crash, use reason 1 (UNSPECIFIED) instead
951+
if(!reason)
952+
reason = WIFI_REASON_UNSPECIFIED;
950953
log_w("Reason: %u - %s", reason, reason2str(reason));
951954
if(reason == WIFI_REASON_NO_AP_FOUND) {
952955
WiFiSTAClass::_setStatus(WL_NO_SSID_AVAIL);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.