Repository navigation
[WebUI] Fix dangling pointer when saving the gateway password - #2408
Merged
1technophile merged 1 commit intoOct 12, 2026
Merged
Conversation
server.arg() returns a String by value, so the pointer from c_str() pointed into a temporary that was destroyed before strlen()/strcpy(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
When the gateway password is saved on the Configure WebUI page (
/cg),handleCG()did:WebServer::arg()returns aStringby value, so that temporary is destroyed at the end of the statement andgppoints to freed memory (heap, or the String's inline buffer for short passwords). The followingstrlen(gp)andstrcpy(ota_pass, gp)read memory that is no longer owned. It usually works because nothing reuses that memory in between, but it can store a wrong password or a wrong length. GCC reports it as-Wdangling-pointeronce the env's-wis removed.The fix keeps the
Stringin a local variable and usesgp.length()andgp.c_str(). The length check and the behaviour are unchanged.Built
lilygo-rtl_433-fskwith the default flags, and with-wremoved and-Walladded: the-Wdangling-pointerwarnings at this spot are gone and the change adds no new warning. Not tested on hardware, because that would mean changing a gateway's password.Checklist:
🤖 Generated with Claude Code