-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Closed
Labels
component: librariestype: bugwaiting for feedbackWaiting on additional info. If it's not received, the issue may be closed.Waiting on additional info. If it's not received, the issue may be closed.
Milestone
Description
ESP8266WiFiScan's ssid(uint8_t i)
function assumes bss_info
's ssid member is null terminated with the following statement:
return String(reinterpret_cast<const char*>(it->ssid));
Now, this works fine for any SSID less than 32 characters, as bss_info will have at least one null byte at the end. In the event that an SSID is exactly 32 characters, bss_info->ssid
will not be null terminated, and the above line will include garbage in the String as it tries to find a null byte beyond the member.
A memcpy of 32 bytes like below guarantees at most 32 characters are read and correctly terminated, and seems to work fine during my testing.
char ssidBuffer[33] = {0};
memcpy(&ssidBufer[0], it->ssid, 32);
return String(ssidBuffer);
Metadata
Metadata
Assignees
Labels
component: librariestype: bugwaiting for feedbackWaiting on additional info. If it's not received, the issue may be closed.Waiting on additional info. If it's not received, the issue may be closed.