RDKEMW-15175: Prevent buffer overflow when binary data contains protocol delimiter bytes#415
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens EthanLog message parsing to avoid memory corruption when binary/garbage data in the logging pipe contains delimiter bytes, and fixes a buffer-compaction bug so consumed bytes are actually removed from the receive buffer.
Changes:
- Fix buffer compaction in
processLogData()by memmoving from the correct source pointer after discarding preamble bytes. - Clarify/guard field handling to better tolerate malformed delimiter sequences.
- Add a defensive length guard in
processMessage()and avoid unsigned wrap by usingstd::min<ssize_t>when capping the message length.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
Test Procedure
The crash is non-deterministic: it only occurs when the binary key bytes happen to contain a 0x1e or 0x1f byte
Type of Change
Requires Bitbake Recipe changes?
meta-rdk-ext/recipes-containers/dobby/dobby.bb) must be modified to support the changes in this PR (beyond updatingSRC_REV)