Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiFi: clean up AP SSID setter & getter, support 32 chars #7941

Merged
merged 9 commits into from
May 15, 2021
Prev Previous commit
Next Next commit
strlen cant be expected to check for null
  • Loading branch information
mcspr committed Apr 3, 2021
commit 3b54881b115abc0caeacf767b8878598171202ca
4 changes: 2 additions & 2 deletions libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 102,13 @@ bool ESP8266WiFiAPClass::softAP(const char* ssid, const char* psk, int channel,
return false;
}

size_t ssid_len = strlen(ssid);
size_t ssid_len = ssid ? strlen(ssid) : 0;
if(ssid_len == 0 || ssid_len > 32) {
DEBUG_WIFI("[AP] SSID length %u, too long or missing!\n", ssid_len);
return false;
}

size_t psk_len = strlen(psk);
size_t psk_len = psk ? strlen(psk) : 0;
if(psk_len > 0 && (psk_len > 64 || psk_len < 8)) {
DEBUG_WIFI("[AP] fail psk length %u, too long or short!\n", psk_len);
return false;
Expand Down