-
Notifications
You must be signed in to change notification settings - Fork 13.3k
SSID wrong lenght validator #4911
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
Comments
You are correct, there current core implementation limits SSID to 31 chars due to the NULL term. This is a known issue, and there has been one attempt to fix it in PR #4691 , but it was not enough, and the author has not replied. |
Thank you for reply. |
@mictlan666 please don't do that, the copy of the ssid into the SDK is currently done with strcpy, and the suspicion is that the SDK array is of size 32. Your change will copy the null terminator, which will corrupt 1 byte after the end of the array inside the SDK, which in turn can potentially cause who knows what instability in your app. |
This should probably use explicit length to prevent that |
Just ran into this, was wondering why my code doesn't work but turns out my SSID is just the max length by the standard(32)... |
Hello,
In file: https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp
Method:
wl_status_t ESP8266WiFiSTAClass::begin(const char* ssid, const char *passphrase, int32_t channel, const uint8_t* bssid, bool connect)
Line:
107
You have that condition:
This is not agree to IEEE 802.11 standard (https://tools.ietf.org/html/rfc3770#section-4)
SSID could have 32 octets, you checking by strlen so 31 octets with NULL in the end will the longest SSID in your case.
I sure about this because of my local wifi network is md5 hash so has 32 octets.
Dont work when i rewrite to 32 const array:
char ssid[32];
You should change condition to
strlen(ssid) > 32
OR rewrite first 32 octets (or to NULL) tochar ssid[32];
Best regards.
The text was updated successfully, but these errors were encountered: