Skip to content
Closed
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion source/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##########################################################################

Check failure on line 1 in source/Makefile.am

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'source/Makefile.am' (Match: components/opensource/rbuscore/components/opensource/rbuscore/1, 17 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/components/opensource/rbuscore/+archive/RDKB-TEST-RELEASE-1.tar.gz, file: cmake_install.cmake)
# If not stated otherwise in this file or this component's Licenses.txt
# file the following copyright and licenses apply:
#
Expand All @@ -20,8 +20,9 @@
AM_CFLAGS += -D_ANSC_USER
AM_CFLAGS += -D_ANSC_LITTLE_ENDIAN_
AM_CFLAGS += -Os -pedantic -std=c99 -Wall -fstrict-aliasing -fomit-frame-pointer -DDUK_USE_PROMISE_BUILTIN
AM_CFLAGS += -Werror -Wno-error=format
AM_LDFLAGS = -lccsp_common
AM_CPPFLAGS = -Wall -Werror
AM_CPPFLAGS = -Wno-error=format
ACLOCAL_AMFLAGS = -I m4
sbin_PROGRAMS = jst
jst_CPPFLAGS = -DBUILD_RDK
Expand Down
2 changes: 1 addition & 1 deletion source/jst_post.c
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@
{
char* cursor = content_data;
char* eof = content_data + content_len;

printf("Test coverity flow %s");

Check warning

Code scanning / CodeQL

Too few arguments to formatting function Medium

Format for printf expects 1 arguments but given 0

Copilot Autofix

AI 6 months ago

In general, to fix “too few arguments to formatting function” issues, either (a) remove or adjust the format specifiers so they match the actual number and types of arguments passed, or (b) add the missing arguments of the correct types to the call. The goal is for each % specifier in the format string to have a corresponding argument.

For this specific call in source/jst_post.c at line 701:

printf("Test coverity flow %s");

the simplest and safest fix without changing existing functionality is to remove the unused %s placeholder, because there is no obvious string we should be printing there and the message appears to just be a static debug string. Changing it to:

printf("Test coverity flow\n");

or

printf("Test coverity flow");

eliminates the format-argument mismatch while preserving the intended debug output. No new imports or helper methods are needed, and the behavior remains a simple console message. If you prefer to keep the %s for some reason, you would instead need to add a corresponding string argument, such as printf("Test coverity flow %s", "");, but that is unnecessarily confusing compared to removing the specifier.

The change is localized to the parse_mpfd function in source/jst_post.c, around line 701, and requires only editing that single printf line.

Suggested changeset 1
source/jst_post.c

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/source/jst_post.c b/source/jst_post.c
--- a/source/jst_post.c
+++ b/source/jst_post.c
@@ -698,7 +698,7 @@
 {
   char* cursor = content_data;
   char* eof = content_data + content_len;
-  printf("Test coverity flow %s");
+  printf("Test coverity flow\n");
   while(cursor < eof)
   {
     while(cursor < eof - boundary_len)
EOF
@@ -698,7 +698,7 @@
{
char* cursor = content_data;
char* eof = content_data + content_len;
printf("Test coverity flow %s");
printf("Test coverity flow\n");
while(cursor < eof)
{
while(cursor < eof - boundary_len)
Copilot is powered by AI and may make mistakes. Always verify output.

Copilot AI Feb 25, 2026

Copy link

Choose a reason for hiding this comment

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

printf("Test coverity flow %s"); uses a %s format specifier without providing an argument, which is undefined behavior and can crash or leak memory. Also, writing to stdout from request parsing can corrupt CGI/HTTP responses; remove this debug print or replace it with the project logging facility with a correct format string and arguments.

Suggested change
printf("Test coverity flow %s");
CosaPhpExtLog("Test coverity flow\n");

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 "%s".

Medium Impact, CWE-685
PRINTF_ARGS

while(cursor < eof)
{
while(cursor < eof - boundary_len)
Expand Down
Loading