Skip to content
Closed
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ DslhDmagntCheckBaseObjNames
}
else
{
rc = sprintf_s(pFullName, sizeof(pFullName), "%s%s", pRootName, buffer);
rc = sprintf_s(pFullName, sizeof(pFullName), "%s%s%s", pRootName, buffer);
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

This change introduces a critical bug. The format string now contains three format specifiers ("%s%s%s") but only two arguments are provided (pRootName and buffer). This mismatch will cause undefined behavior when sprintf_s attempts to read a third argument that doesn't exist, potentially leading to crashes or memory corruption.

The original code with two format specifiers ("%s%s") correctly matched the two provided arguments. Looking at the similar pattern on line 1236, the else branch on line 1243 should concatenate pRootName and buffer without adding a trailing dot (since buffer already ends with a dot based on the condition on line 1234). The format string should remain "%s%s" with two arguments.

Suggested change
rc = sprintf_s(pFullName, sizeof(pFullName), "%s%s%s", pRootName, buffer);
rc = sprintf_s(pFullName, sizeof(pFullName), "%s%s", pRootName, buffer);

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Coverity Issue - Missing argument to printf format specifier

No argument for format specifier "%s".

Medium Impact, CWE-685
PRINTF_ARGS

if(rc < EOK)
{
ERR_CHK(rc);
Expand Down