Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion source/reportgen/reportgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ static bool checkForEmptyString( char* valueString )
{
// rbusInterface implementation explicitly adds string as "NULL" for parameters which doesn't exist on device
// Consider "NULL" string value as qualified for empty string
if(strlen(valueString) < 1 || !strncmp(valueString, " ", 1) || !strncmp(valueString, "NULL", 4))
// If the string has zero value it should be ignored
if(strlen(valueString) < 1 || !strncmp(valueString, " ", 1) || !strncmp(valueString, "0", 1) || !strncmp(valueString, "NULL", 4))
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

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

The check !strncmp(valueString, "0", 1) will match any string starting with "0", not just the string "0". This means valid values like "01", "012345", "0.5", or "0x1A" would also be incorrectly treated as empty. Consider using strcmp(valueString, "0") == 0 or strlen(valueString) == 1 && valueString[0] == '0' to match only the exact string "0".

Suggested change
if(strlen(valueString) < 1 || !strncmp(valueString, " ", 1) || !strncmp(valueString, "0", 1) || !strncmp(valueString, "NULL", 4))
if(strlen(valueString) < 1 || !strncmp(valueString, " ", 1) || strcmp(valueString, "0") == 0 || !strncmp(valueString, "NULL", 4))

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

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

The test CheckForEmptyString in source/test/reportgen/reportgenTest.cpp needs to be updated to include test cases for the new "0" check. Currently, the test covers NULL, empty string, space, and "NULL" literal, but doesn't test the newly added "0" behavior to verify it works as intended.

Copilot uses AI. Check for mistakes.
{
isEmpty = true ;
T2Debug("Marker Value is empty or zero or NULL\n");
}
Comment on lines +42 to 47
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

checkForEmptyString() now treats the string "0" as empty, but the existing unit test for this helper (in source/test/reportgen/reportgenTest.cpp, TEST(CheckForEmptyString, AllBranchesAreCovered)) does not cover the new branch. Please add a test case asserting that "0" returns true to prevent regressions.

Copilot uses AI. Check for mistakes.
}
else
Expand Down