-
-
Notifications
You must be signed in to change notification settings - Fork 346
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
Fix 64 character WPA2 PSK password. #1146
base: develop
Are you sure you want to change the base?
Conversation
@@ -70,7 +70,10 @@ bool StationClass::config(String ssid, String password, bool autoConnectOnStartu | |||
memset(config.password, 0, sizeof(config.password)); | |||
config.bssid_set = false; | |||
strcpy((char*)config.ssid, ssid.c_str()); | |||
strcpy((char*)config.password, password.c_str()); | |||
if (password.length() == 64) | |||
memcpy((char*)config.password, password.c_str(), 64); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue with this is that station_config::password is exactly 64 chars so you will have no ending zero... IMHO the correct fix would be to declare uint8 password[65]; in esp_sta.h, and signal a bug to espressif.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WPA passphrases are 8-63 ASCII characters by 802.11 spec so this is not a bug.
I've been there. |
This change does not fix any problem because there is still 63 characters limit in SDK for both AP and station. Did anybody made a test how the application on esp behaves if wifi has 64 characters passphrase? Will it connect at all? |
It works fine for me in station mode, my home network access point is using a 64 character passphrase. |
Ok, none of my access points I have at home allows passphrases longer than 63 chars so I have no chance to test this. |
To me still not clear what happens here if you use the 64th position for passphrase and no space left for zero ending the string. Maybe the sdk has special way of reading from this array? |
Tape side A: ESP8266 core for Arduino gets this wrong, against IEEE 802.11 spec and against vendor published SDK. My guess is SDK just copies array using |
7b19c1b
to
295a5f3
Compare
See: esp8266/Arduino#1921
and esp8266/Arduino@1b8f6d2