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

Prevent AP setup with too short password #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

gemenerik
Copy link
Member

This PR ensures that the firmware does not attempt to set up an access point if the configured password is shorter than 8 characters. If an invalid password is detected, a warning is logged to inform the user (visible in cfclient console), and the AP setup is skipped.

Fixes #15

@gemenerik gemenerik requested a review from ToveRumar January 30, 2025 15:35
@@ -235,8 +235,12 @@ static void wifi_ctrl(void* _param) {
if (rxp.data[1] == 0) {
wifi_init_sta(ssid, key);
} else {
wifi_init_softap(ssid, key);
}
if (strlen(key) < 8) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we only check the length so it must be longer than 7, we can never set up an AP with open security.

Inside the wifi_init_softap() the authentication mode is set to open if the password is longer than 0.
I would say we should check the invalid range.

Suggested change
if (strlen(key) < 8) {
if (0 < strlen(key) && strlen(key) < 8) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not crash on WiFi passwords shorter than 8 characters
2 participants