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
2 changes: 1 addition & 1 deletion Source/deviceinfo/device_info/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
*bufLength = length;

} else {
printf("ERROR: bufLength %d is too small for %d chars\n", *bufLength, totalLength);
printf("ERROR: bufLength %d is too small for %d chars\n", totalLength);

Check warning

Code scanning / Coverity

Printf arg count mismatch

PW.TOO_FEW_PRINTF_ARGS: the format string requires additional arguments

Check warning

Code scanning / Coverity

Missing argument to printf format specifier

PRINTF_ARGS: No argument for format specifier "%d".
Comment thread Fixed
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The printf statement now has only one format argument (%d) but only provides one value (totalLength), whereas the original error message format string has two %d placeholders. This means the second %d will print garbage/undefined values. The original version correctly provided both *bufLength and totalLength as arguments to match the two %d format specifiers in the error message.

Suggested change
printf("ERROR: bufLength %d is too small for %d chars\n", totalLength);
printf("ERROR: bufLength %d is too small for %d chars\n", *bufLength, totalLength);

Copilot uses AI. Check for mistakes.
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.

Coverity Issue - Printf arg count mismatch

the format string requires additional arguments

Medium Impact, CWE-685
PW.TOO_FEW_PRINTF_ARGS

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.

Coverity Issue - Missing argument to printf format specifier

No argument for format specifier "%d".

Medium Impact, CWE-685
PRINTF_ARGS

*bufLength = 0;
}
}
Expand Down
Loading