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

Protect against logical comparison errors in wifi_connect.c #265

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

Conversation

e5h
Copy link

@e5h e5h commented Jul 22, 2024

If any additional bits are being used in wifi_connect (eg. by setting both a CONNECTED and IP_ASSIGNED flag), a direct comparison of result == CONNECTED will fail even if the CONNECTED bit is set, due to the presence of other bits.

Since the checked flags are cleared via xClearOnExit = pdTRUE, the flag notifying an IP assignment will be lost, and not set again in any reasonable amount of time. This is a simple change to evaluate the bitwise & result of the return to evaluate if the correct flag has been set.

If additional flags are set in the wifi events, a direct comparison of "result == CONNECTED" will fail even if the bits are set. Since these flags were cleared, the wifi will be connected but never return the correct status from "wifi_connect_sta".
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.

1 participant