Skip to content

fix(radio): check for negative and overlong credential lengths#49

Merged
deadprogram merged 1 commit into
mainfrom
protect-ssid-length
Jun 12, 2026
Merged

fix(radio): check for negative and overlong credential lengths#49
deadprogram merged 1 commit into
mainfrom
protect-ssid-length

Conversation

@deadprogram

Copy link
Copy Markdown
Member

Reject negative ssid_len and pwd_len in station and AP configurations to prevent integer/cast wrap-around that causes out-of-bounds memcpy.

Orginally suggested by PR #48 thanks!

Comment thread radio.c Outdated
}
wifi_config_t cfg;
memset(&cfg, 0, sizeof(cfg));
if (ssid_len > 32) ssid_len = 32;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hmm, this also uncovers the silent ignore for ssid/pass longer than expected being just truncated to 32/64 chars - wouldn't it be better to return error here also? (and probably check this in user code for nicer errors?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Just modified to return an error in the case of overlong ssid/pass instead of truncating it. Good catch!

Reject negative or overlong ssid_len and pwd_len in station and AP configurations
to prevent integer/cast wrap-around that causes out-of-bounds memcpy.

Orginally suggested by PR #48 thanks!

Signed-off-by: deadprogram <ron@hybridgroup.com>
@deadprogram deadprogram force-pushed the protect-ssid-length branch from 541a1ff to f04709d Compare June 12, 2026 15:09
@deadprogram deadprogram changed the title fix(radio): check for negative credential lengths fix(radio): check for negative and overlong credential lengths Jun 12, 2026
@deadprogram

Copy link
Copy Markdown
Member Author

@b0ch3nski PTAL at my changes from your feedback.

@b0ch3nski b0ch3nski left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM, thanks!

@deadprogram deadprogram merged commit 1138bc8 into main Jun 12, 2026
1 check passed
@deadprogram deadprogram deleted the protect-ssid-length branch June 12, 2026 19:09
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.

2 participants