This commit is contained in:
Daniel Baek 2025-07-02 23:50:01 -04:00 committed by GitHub
commit 01a142bb60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -36,6 +36,7 @@ extern "C" {
// Array of data to cache the information related to the networks discovered
char WiFiDrv::_networkSsid[][WL_SSID_MAX_LENGTH] = {{"1"},{"2"},{"3"},{"4"},{"5"}};
char WiFiDrv::nullTermSsid[WL_SSID_MAX_LENGTH + 1]{};
// Cached values of retrieved data
char WiFiDrv::_ssid[] = {0};
@ -566,7 +567,7 @@ const char* WiFiDrv::getSSIDNetoworks(uint8_t networkItem)
if (networkItem >= WL_NETWORKS_LIST_MAXNUM)
return (char*)NULL;
return _networkSsid[networkItem];
return strncpy(nullTermSsid, _networkSsid[networkItem], WL_SSID_MAX_LENGTH);
}
uint8_t WiFiDrv::getEncTypeNetowrks(uint8_t networkItem)

View file

@ -39,6 +39,7 @@ class WiFiDrv
private:
// settings of requested network
static char _networkSsid[WL_NETWORKS_LIST_MAXNUM][WL_SSID_MAX_LENGTH];
static char nullTermSsid[WL_SSID_MAX_LENGTH + 1];
// firmware version string in the format a.b.c
static char fwVersion[WL_FW_VER_LENGTH];