Repository navigation
Conversation
The repeater, room server and sensor wrappers echo an optional 3-byte "xx|" prefix into the reply and advance `reply` past it before calling CommonCLI::handleCommand(). Serial callers pass char reply[160] and remote callers &temp[5] of uint8_t temp[166], so CommonCLI can rely on 157 bytes. Several of its writers bound themselves at 160 instead. Two of them echo the admin's own text. "set" with an unknown 151-character key writes 2 bytes past a serial reply and 1 past a remote one. "region def" with a 144-character name that putRegion() rejects writes 3 and 2. The region exports and "gps diag" share the same bound. Add CLI_REPLY_SIZE (157) to CommonCLI.h and use it for every reply bound in CommonCLI.cpp. A reply without the prefix loses at most its last 3 characters. ZephCore fixed the same overrun in liquidraver/ZephCore@ad23dcb, by subtracting the prefix from its separate remote bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🟢 Approval recommended
The changed bounds match the smallest caller capacity; the remaining documentation nit is non-blocking.
0 open findings
What changed in this PR
This PR limits CommonCLI replies to the 157 bytes available after a caller echoes an optional prefix, addressing the buffer overrun described in #25.
Changes:
- Defines a shared reply-size limit.
- Applies it to reply writers, including GPS diagnostics and region commands.
| File | Description |
|---|---|
src/helpers/CommonCLI.h |
Defines and explains the 157-byte limit. |
src/helpers/CommonCLI.cpp |
Uses the limit for affected reply bounds. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Iteration branch for #25. Keep it open; never merge it. A clean single-commit branch for upstream is cut from it once it has baked. Pieter's decision on 2026-10-10: nothing goes upstream until a maintainer engages with one of our open PRs.
References:
dev2dbd463e024254a4cli-reply-bound-harness.cpp, a host transcription of the writers and the wrapper, with inputs constructed in the program.The defect
The repeater, room server and sensor wrappers echo an optional 3-byte
xx|prefix into the reply and advancereplypast it before callingCommonCLI::handleCommand(). A serial caller'schar reply[160]and a remote caller's&temp[5]ofuint8_t temp[166]therefore leaveCommonCLI157 and 158 bytes. Several of its writers bound themselves at 160 instead. #25 has the permalinks.The fix
CommonCLI.hL25-L28 addsCLI_REPLY_SIZE(157), with the derivation in a comment.CommonCLI.cppnow uses it: L272, L294, L376-L380, L697, L735, L872-L881, L897, L903, L910 and L1020. The change only replaces the literal, so the line numbers matchdev.Evidence
Measured with the harness. Each command is at most 158 characters, which is what a serial
command[160]keeps:reply[160]temp[166]xx|set+ a 151-character keydev)xx|set+ a 151-character keyxx|region def+ a 144-character name with a.dev)xx|region def+ a 144-character name with a.xx|get owner.info,owner_infofull (control)Testing
RAK_4631_repeater,RAK_4631_room_server,RAK_4631_sensorandheltec_v4_r8_repeaterall build at024254a4.Notes
sensor listand neighbours loops, which stop adding entries at a fixed 134 bytes. Upstream Reject a negativesensor liststart index 🤖🤖 meshcore-dev/MeshCore#3433 left thesensor listbound as it is, and the neighbours loop isn't audited here.Refs #25
🤖 Generated with Claude Code