Skip to content

CMFSUPPORT-3891 : COVERITY TEST. DO NOT MERGE#38

Closed
snampo768 wants to merge 3 commits intodevelopfrom
feature/test-workflow
Closed

CMFSUPPORT-3891 : COVERITY TEST. DO NOT MERGE#38
snampo768 wants to merge 3 commits intodevelopfrom
feature/test-workflow

Conversation

@snampo768
Copy link

DO NOT MERGE

Copilot AI review requested due to automatic review settings February 25, 2026 06:51
@snampo768 snampo768 requested review from a team as code owners February 25, 2026 06:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR appears intended as a Coverity/static-analysis test change in the hotspotfd component, and the metadata explicitly indicates it should not be merged.

Changes:

  • Adds a debug print(...) call in TunnelStatus_GetStringHandler.
  • Disables treating format warnings as errors for hotspotfd by adding -Wno-error=format.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
source/hotspotfd/hotspotfd.c Adds a debug print statement in the RBUS get handler.
source/hotspotfd/Makefile.am Suppresses format warnings being promoted to errors during compilation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

AM_CFLAGS += -I$(top_srcdir)/source/hotspotfd/include
AM_CFLAGS += -I$(top_srcdir)/source/HotspotApi
AM_CFLAGS += -I${PKG_CONFIG_SYSROOT_DIR}$(includedir)/rbus
AM_CFLAGS += -Wno-error=format
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Adding -Wno-error=format masks format-string problems project-wide for this component, including real bugs that would otherwise be caught at build time. Since the introduced format issue should be fixed at the call site, please drop this flag and keep format warnings as errors.

Suggested change
AM_CFLAGS += -Wno-error=format

Copilot uses AI. Check for mistakes.
rbusProperty_SetValue(property, val);
rbusValue_Release(val);

print("Test coverity flow, %s")
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

The added print("Test coverity flow, %s") line will not compile as written: print is not a standard C API in this codebase, the statement is missing a trailing semicolon, and the format string contains %s without a corresponding argument. Please remove this debug line or replace it with an existing logging/printf facility and provide the correct format arguments (or drop %s).

Suggested change
print("Test coverity flow, %s")

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings February 25, 2026 07:59
rbusProperty_SetValue(property, val);
rbusValue_Release(val);

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 5 days ago

In general, to fix "too few arguments to formatting function" issues, you must ensure that the number and types of arguments passed to functions like printf match the format specifiers in the format string. Either (a) add the missing arguments corresponding to each specifier, or (b) remove or adjust the specifiers so that the format string no longer expects arguments that are not provided.

For this specific case in TunnelStatus_GetStringHandler in source/hotspotfd/hotspotfd.c, line 379 calls printf("Test coverity flow, %s"); with a %s specifier and no string argument. The function does not naturally have an appropriate string to print there (and appears to be a simple test message). The least intrusive correction that does not alter existing behavior is to remove the %s from the format string, turning it into a plain string literal: printf("Test coverity flow\n"); (optionally adding a newline for cleanliness). This preserves the intent—a simple test print—without changing program logic, while eliminating the undefined behavior. No new methods, imports, or definitions are required, and no other parts of the file need changes.

Suggested changeset 1
source/hotspotfd/hotspotfd.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/hotspotfd/hotspotfd.c b/source/hotspotfd/hotspotfd.c
--- a/source/hotspotfd/hotspotfd.c
+++ b/source/hotspotfd/hotspotfd.c
@@ -376,7 +376,7 @@
     rbusProperty_SetValue(property, val);
     rbusValue_Release(val);
     
-    printf("Test coverity flow, %s");
+    printf("Test coverity flow\n");
     return RBUS_ERROR_SUCCESS;
 }
 
EOF
@@ -376,7 +376,7 @@
rbusProperty_SetValue(property, val);
rbusValue_Release(val);

printf("Test coverity flow, %s");
printf("Test coverity flow\n");
return RBUS_ERROR_SUCCESS;
}

Copilot is powered by AI and may make mistakes. Always verify output.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

AM_CFLAGS += -I$(top_srcdir)/source/hotspotfd/include
AM_CFLAGS += -I$(top_srcdir)/source/HotspotApi
AM_CFLAGS += -I${PKG_CONFIG_SYSROOT_DIR}$(includedir)/rbus
AM_CFLAGS += -Wno-error=format
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Adding -Wno-error=format suppresses format string warnings and errors for the entire build. This flag appears to be added to enable the problematic printf statement on line 379 of hotspotfd.c, which has a format string security vulnerability. Instead of suppressing these important security warnings, the underlying format string issue should be fixed. Format string vulnerabilities can lead to information disclosure or code execution.

Suggested change
AM_CFLAGS += -Wno-error=format

Copilot uses AI. Check for mistakes.
rbusProperty_SetValue(property, val);
rbusValue_Release(val);

printf("Test coverity flow, %s");
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 - Printf arg count mismatch

the format string requires additional arguments

Medium Impact, CWE-685
PW.TOO_FEW_PRINTF_ARGS

rbusProperty_SetValue(property, val);
rbusValue_Release(val);

printf("Test coverity flow, %s");
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

@snampo768
Copy link
Author

Close PR

@snampo768 snampo768 closed this Feb 25, 2026
@snampo768 snampo768 deleted the feature/test-workflow branch February 25, 2026 08:33
@github-actions github-actions bot locked and limited conversation to collaborators Feb 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants