Skip to content

devpilot-test: Fix Coverity defects (1 file)#452

Open
rdkdevpilot wants to merge 1 commit into
developfrom
topic/devpilot-test
Open

devpilot-test: Fix Coverity defects (1 file)#452
rdkdevpilot wants to merge 1 commit into
developfrom
topic/devpilot-test

Conversation

@rdkdevpilot

Copy link
Copy Markdown

Automated Fix for Coverity Defects

Triggered by: Sandeep Nair2

Fixed Files

File Line(s) CIDs Checker Types Description
sampleapps/provider/rbusTableProvider.c L399 39984 BUFFER_SIZE Buffer not null terminated

Fix Summaries

sampleapps/provider/rbusTableProvider.c

The fix correctly addresses the BUFFER_SIZE defect in setHandler2 by reducing the strncpy count to MAX_LENGTH-1 and explicitly null-terminating t2->data[MAX_LENGTH-1]. This is a standard, correct pattern for safe string copying. The fix is minimal, targets only the flagged location, preserves all existing logic, and matches the code style used elsewhere in the file.

Defect ID: b98120cd-64be-4bd6-9796-eb892770bfc3
@rdkdevpilot
rdkdevpilot requested a review from a team as a code owner July 10, 2026 21:54
Copilot AI review requested due to automatic review settings July 10, 2026 21:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 a Coverity-reported BUFFER_SIZE defect in the RBUS table provider sample by ensuring a string copied into a fixed-size buffer is always null-terminated.

Changes:

  • Adjusted strncpy length for t2->data to MAX_LENGTH-1.
  • Explicitly set t2->data[MAX_LENGTH-1] to '\0' after copying.

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

Comment on lines 397 to +400
if(propertyNameEquals(name, "Data"))
{
strncpy(t2->data, rbusValue_GetString(value, NULL), MAX_LENGTH);
strncpy(t2->data, rbusValue_GetString(value, NULL), MAX_LENGTH-1);
t2->data[MAX_LENGTH-1] = '\0';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants