-
Notifications
You must be signed in to change notification settings - Fork 9
CMFSUPPORT-3863. COVERITY TEST. DO NOT MERGE #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,9 +17,10 @@ | |
| ########################################################################## | ||
| AM_CFLAGS = -D_ANSC_LINUX | ||
| AM_CFLAGS += -D_ANSC_USER | ||
| AM_CFLAGS += -Wno-format | ||
| AM_LDFLAGS = -lccsp_common -lsysevent -lwebconfig_framework -lmsgpackc -ltrower-base64 | ||
|
|
||
| AM_CPPFLAGS = -Wall -Werror | ||
| AM_CPPFLAGS = -Wall -Wno-format | ||
|
||
| ACLOCAL_AMFLAGS = -I m4 | ||
| hardware_platform = i686-linux-gnu | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -294,7 +294,7 @@ | ||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||
| if ((file = fopen(fpath, "w"))) | |||||||||||||||||||||||||||||||||
| { | |||||||||||||||||||||||||||||||||
| fprintf(file,"%s",str); | |||||||||||||||||||||||||||||||||
| fprintf(file,"%s%s",str); | |||||||||||||||||||||||||||||||||
Check failureCode scanning / Coverity Missing argument to printf format specifier High
PRINTF_ARGS: No argument for format specifier "%s".
Check noticeCode scanning / Coverity Printf arg count mismatch Low
PW.TOO_FEW_PRINTF_ARGS: the format string requires additional arguments
|
|||||||||||||||||||||||||||||||||
Check warningCode scanning / CodeQL Too few arguments to formatting function Medium
Format for fprintf expects 2 arguments but given 1
Copilot AutofixAI 5 days ago In general, to fix “too few arguments to formatting function” issues, ensure that the number and types of arguments after the format string exactly match the conversion specifiers in the format. You can either (1) adjust the format string to use fewer specifiers, or (2) pass additional arguments so that every specifier has a corresponding value. In this specific case in fprintf(file,"%s%s",str);uses a format string with two fprintf(file, "%s", str);No new headers or helper functions are required; we just correct the format string at line 297 in the shown snippet. Everything else in the function can remain unchanged.
Suggested changeset
1
source/AdvSecurityDml/cosa_adv_security_internal.c
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||||||
| fprintf(file,"%s%s",str); | |
| fprintf(file, "%s", str); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding -Wno-format suppresses compiler warnings for format string mismatches, which would hide serious bugs like format string vulnerabilities and incorrect argument counts. This flag is masking the bug in line 294 of cosa_adv_security_internal.c where fprintf has mismatched format specifiers and arguments. Format warnings should not be suppressed as they catch critical security and correctness issues.