Skip to content

RDK-60307 [RRD] RDK Coverity Defect Resolution for Device Management#175

Merged
shibu-kv merged 2 commits intodevelopfrom
feature/RDK-60307
Feb 25, 2026
Merged

RDK-60307 [RRD] RDK Coverity Defect Resolution for Device Management#175
shibu-kv merged 2 commits intodevelopfrom
feature/RDK-60307

Conversation

@madhubabutt
Copy link
Copy Markdown
Contributor

@madhubabutt madhubabutt commented Feb 3, 2026

Reason for change: Coverity Fix in RRD
Test Procedure: Build and Verify RRD Functionality
Risks: Low
Priority: P1
Signed-off-by:Tirumala, Madhubabu (Contractor) Madhubabu_Tirumala@comcast.com

@madhubabutt madhubabutt requested a review from a team as a code owner February 3, 2026 14:50
Copilot AI review requested due to automatic review settings February 3, 2026 14:50
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 3, 2026

Code Coverage Summary

                               Total:|83.6%   5104|97.6%  1301|    -      0

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 pull request addresses Coverity defects in the RDK Remote Debugger Device Management code, focusing on fixing memory leaks, buffer overflows, and resource handling issues.

Changes:

  • Added NULL checks for memory allocations (malloc, strdup, fread) with proper error handling and resource cleanup
  • Fixed buffer overflow vulnerabilities by using correct size parameters in strncpy/strncat operations
  • Corrected file pointer closure to only occur when pointers are valid (v_secure_pclose moved inside if blocks)
  • Fixed memory management issues with rfcbuf allocations and ownership

Reviewed changes

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

File Description
src/rrdRunCmdThread.c Added mutex protection for cacheDataNode initialization; fixed buffer overflow in strncpy/strncat; corrected v_secure_pclose placement to prevent potential crashes
src/rrdJsonParser.c Added NULL checks for malloc/strdup/fread operations with proper cleanup; fixed rfcbuf memory leaks in error paths; clarified rfcbuf ownership with comment
src/rrdEventProcess.c Fixed staticstrlen calculation after quote removal; corrected appendstrlen calculation; improved realloc error handling with proper log level

@rdkcmf-jenkins
Copy link
Copy Markdown
Contributor

rdkcmf-jenkins commented Feb 3, 2026

Coverity Issue - Resource leak

Variable "staticprofiledata" going out of scope leaks the storage it points to.

High Impact, CWE-404
RESOURCE_LEAK

Issue location

This issue was discovered outside the diff for this Pull Request. You can find it at:
src/rrdEventProcess.c:251

Copilot AI review requested due to automatic review settings February 6, 2026 08:17
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

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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 6, 2026

Code Coverage Summary

                               Total:|83.2%   5126|97.6%  1301|    -      0

Copilot AI review requested due to automatic review settings February 9, 2026 06:16
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 9, 2026

Code Coverage Summary

                               Total:|83.0%   5136|97.6%  1301|    -      0

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

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

Comments suppressed due to low confidence (1)

src/rrdInterface.c:348

  • dataMsg is freed only in the empty-message branch. In the non-empty case, dataMsg is passed to pushIssueTypesToMsgQueue and never freed anywhere in the current flow, which leaks per event. Either make pushIssueTypesToMsgQueue deep-copy the string so the caller can always free dataMsg, or ensure the consumer frees the message buffer after processing (but keep ownership consistent to avoid double-free).
    strncpy(dataMsg, rbusValue_GetString(value, NULL), len-1);
    dataMsg[len-1]='\0';

    if (dataMsg[0] == '\0' || len <= 0  )
    {
        RDK_LOG(RDK_LOG_DEBUG,LOG_REMDEBUG,"[%s:%d]: Message Received is empty, Exit Processing!!! \n", __FUNCTION__, __LINE__);
        free(dataMsg);
    }
    else
    {
        pushIssueTypesToMsgQueue(dataMsg, EVENT_MSG);
    }

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 9, 2026

Code Coverage Summary

                               Total:|83.1%   5132|97.6%  1301|    -      0

Copilot AI review requested due to automatic review settings February 9, 2026 09:10
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 9, 2026

Code Coverage Summary

                               Total:|82.8%   5148|97.6%  1301|    -      0

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

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

@github-actions
Copy link
Copy Markdown

Code Coverage Summary

                               Total:|82.8%   5150|97.6%  1301|    -      0

@github-actions
Copy link
Copy Markdown

Code Coverage Summary

                               Total:|82.8%   5150|97.6%  1301|    -      0

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

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

Comments suppressed due to low confidence (1)

src/rrdEventProcess.c:123

  • processIssueTypeEvent() allocates/receives a heap data_buf* rbuf from the message queue but never deallocates it (nor rbuf->mdata) before returning. This makes the /* coverity[leaked_storage] */ suppressions elsewhere more likely to be masking a real leak. Consider establishing a clear ownership rule (e.g., consumer always calls RRD_data_buff_deAlloc(rbuf) after processing) and avoid freeing mdata/jsonPath in deep callees if the caller is responsible.
                free(cmdMap);
		cmdMap = NULL;
	    }
        }
    }

@github-actions
Copy link
Copy Markdown

Code Coverage Summary

                               Total:|82.8%   5150|97.6%  1301|    -      0

Copilot AI review requested due to automatic review settings February 12, 2026 05:28
@github-actions
Copy link
Copy Markdown

Code Coverage Summary

                               Total:|82.8%   5150|97.6%  1301|    -      0

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

@github-actions
Copy link
Copy Markdown

Code Coverage Summary

                               Total:|82.8%   5150|97.6%  1301|    -      0

Copilot AI review requested due to automatic review settings February 12, 2026 06:24
@github-actions
Copy link
Copy Markdown

Code Coverage Summary

                               Total:|82.8%   5150|97.6%  1301|    -      0

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

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

@github-actions
Copy link
Copy Markdown

Code Coverage Summary

                               Total:|83.0%   5148|97.7%  1301|    -      0

Copilot AI review requested due to automatic review settings February 19, 2026 06:21
@github-actions
Copy link
Copy Markdown

Code Coverage Summary

                               Total:|83.0%   5148|97.7%  1301|    -      0

@github-actions
Copy link
Copy Markdown

Code Coverage Summary

                               Total:|83.0%   5148|97.7%  1301|    -      0

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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

@shibu-kv shibu-kv merged commit 2fd7e90 into develop Feb 25, 2026
13 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 25, 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.

6 participants