fix(companion): gate CMD_SEND_CHANNEL_DATA payload on MAX_GROUP_DATA_LENGTH - #3386
Open
tekk wants to merge 1 commit into
Open
fix(companion): gate CMD_SEND_CHANNEL_DATA payload on MAX_GROUP_DATA_LENGTH#3386tekk wants to merge 1 commit into
tekk wants to merge 1 commit into
Conversation
…LENGTH Payloads of 166 or 167 bytes previously passed the frame-sized bound (MAX_CHANNEL_DATA_LENGTH = 167) but were rejected by sendGroupData against MAX_GROUP_DATA_LENGTH (165), causing ERR_CODE_TABLE_FULL (retry later) to be returned instead of ERR_CODE_ILLEGAL_ARG. Fixes meshcore-dev#3345
There was a problem hiding this comment.
🟢 Approval recommended
The updated bound matches the radio-side constraint and resolves the incorrect error mapping without introducing new behavioral or build issues in the touched code path.
Pull request overview
This PR fixes an outbound payload-length validation bug in the companion radio protocol handler so CMD_SEND_CHANNEL_DATA rejects oversized payloads with a permanent error (ERR_CODE_ILLEGAL_ARG) instead of misreporting a transient condition (ERR_CODE_TABLE_FULL) that would cause compliant clients to retry indefinitely.
Changes:
- Gate
CMD_SEND_CHANNEL_DATAoutbound payloads against the radio payload limit (MAX_GROUP_DATA_LENGTH) rather than the host-frame limit (MAX_CHANNEL_DATA_LENGTH). - Update the associated debug log to report the correct bound.
- Leave
MAX_CHANNEL_DATA_LENGTHin place for inboundonChannelDataRecv, where it correctly enforces the host frame budget.
File summaries
| File | Description |
|---|---|
| examples/companion_radio/MyMesh.cpp | Fixes outbound payload-length validation for CMD_SEND_CHANNEL_DATA to align with the radio-side maximum payload size. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: 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.
Summary
Fixes #3345.
CMD_SEND_CHANNEL_DATA(0x3E) inexamples/companion_radio/MyMesh.cppgated outbound payloads againstMAX_CHANNEL_DATA_LENGTH(MAX_FRAME_SIZE - 9 = 167bytes) instead of the radio-side boundMAX_GROUP_DATA_LENGTH(184 - 16 - 3 = 165bytes).Payloads of 166 or 167 bytes passed the handler check, but were rejected by
BaseChatMesh::sendGroupData(data_len > MAX_GROUP_DATA_LENGTH). BecausesendGroupDatareturnsfalse,MyMesh.cppreturnedERR_CODE_TABLE_FULL(3) instead ofERR_CODE_ILLEGAL_ARG(6).Since
ERR_CODE_TABLE_FULLindicates a transient queue-full condition, conforming clients would retry indefinitely on a payload that can never succeed.Changes
examples/companion_radio/MyMesh.cpp, checkpayload_len > MAX_GROUP_DATA_LENGTHinstead ofMAX_CHANNEL_DATA_LENGTHand update the accompanying debug log.MAX_CHANNEL_DATA_LENGTHis preserved inonChannelDataRecv, where it correctly bounds inbound host frames.Verification
pio test -e native(PASSED 46/46)pio test -e native_kiss_modem(PASSED 8/8)pio run -e Heltec_v3_companion_radio_ble(SUCCESS)