Skip to content

RDKB-64598 : Coverity issues in ccsp-moca component#32

Closed
SuneethaLakshmi wants to merge 1 commit intodevelopfrom
feature/RDKB-64598
Closed

RDKB-64598 : Coverity issues in ccsp-moca component#32
SuneethaLakshmi wants to merge 1 commit intodevelopfrom
feature/RDKB-64598

Conversation

@SuneethaLakshmi
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings April 30, 2026 15:45
@SuneethaLakshmi SuneethaLakshmi requested review from a team as code owners April 30, 2026 15:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses static analysis (Coverity) findings in the ccsp-moca component and MRD by tightening pointer validation and preventing buffer overruns/unterminated string handling in a few MoCA and ARP-parsing code paths.

Changes:

  • Add a NULL check for MCfg in CosaDmlMocaIfReset() before dereferencing it.
  • Add/extend “string termination” handling for selected MoCA HAL fields prior to moca_SetIfConfig() calls.
  • Fix /proc/net/arp parsing to avoid overflowing the MAC address buffer by reducing the %s scan width and resizing the temporary IP buffer.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
source/TR-181/board_sbapi/cosa_moca_webconfig_api.c Adds additional termination logic before rollback moca_SetIfConfig() call.
source/TR-181/board_sbapi/cosa_moca_apis.c Adds MCfg NULL guard and additional termination logic around MoCA config sync/reset paths.
source/MRD/mrd.c Fixes ARP cache parsing format/temporary buffers to prevent overruns.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +308 to +309
/* Coverity CID 348464: STRING_NULL — ensure HAL string fields are terminated */
mocaCfg.NodeTabooMask[sizeof(mocaCfg.NodeTabooMask) - 1] = 0;
mocaCfg.Alias[sizeof(mocaCfg.Alias) - 1] = '\0';
mocaCfg.KeyPassphrase[sizeof(mocaCfg.KeyPassphrase) - 1] = '\0';

mocaCfg.NodeTabooMask[sizeof(mocaCfg.NodeTabooMask) - 1] = 0;
Comment on lines +1090 to +1091
/* CID 348463 coverity fix for string null error */
mocaCfg.NodeTabooMask[sizeof(mocaCfg.NodeTabooMask) - 1] = 0;
@github-actions github-actions Bot locked and limited conversation to collaborators May 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants