Closed
Description
I need to use a PSK instead of a passphrase to connect to WiFi networks using the WiFiMulti library. However, I noticed in the code that there's a length limit of 63 for the argument passphrase.
WiFiMulti.cpp:
bool WiFiMulti::addAP(const char* ssid, const char *passphrase)
{
WifiAPlist_t newAP;
if(!ssid || *ssid == 0x00 || strlen(ssid) > 31) {
// fail SSID too long or missing!
log_e("[WIFI][APlistAdd] no ssid or ssid too long");
return false;
}
if(passphrase && strlen(passphrase) > 63) {
// fail passphrase too long!
log_e("[WIFI][APlistAdd] passphrase too long");
return false;
}
and unsurprisingly I got the following error when I call addAP
with a PSK which is 64 bytes long:
[E][WiFiMulti.cpp:61] addAP(): [WIFI][APlistAdd] passphrase too long
The thing is WiFi.begin takes PSK as the passphrase argument just fine and I was able to successfully connect when I changed the passphrase length limit to 64 instead.
[I][WiFiMulti.cpp:84] addAP(): [WIFI][APlistAdd] add SSID: XXXXXX
[I][WiFiMulti.cpp:119] run(): [WIFI] 14 networks found
[I][WiFiMulti.cpp:160] run(): [WIFI] Connecting BSSID: A8:E5:44:XX:XX:XX SSID: XXXXXX Channal: 7 (-46)
[I][WiFiMulti.cpp:174] run(): [WIFI] Connecting done.
I would like to know if this is a bug where the passphrase argument length limit was not revised when PSK support was added or if there are other concerns for allowing PSK here. Thanks.
Metadata
Metadata
Assignees
Labels
Issue is stale stage (outdated/stuck)Issue is stale stage (outdated/stuck)