Skip to content

Fix #14899: FP invalidPrintfArgType_float with _sprintf_s_l() #8729

Open
ludviggunne wants to merge 4 commits into
cppcheck-opensource:mainfrom
ludviggunne:14899-sprintf
Open

Fix #14899: FP invalidPrintfArgType_float with _sprintf_s_l() #8729
ludviggunne wants to merge 4 commits into
cppcheck-opensource:mainfrom
ludviggunne:14899-sprintf

Conversation

@ludviggunne

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread test/testio.cpp
Comment thread test/testio.cpp
"[test.cpp:17:5]: (warning) %s in format string (no. 5) requires 'char *' but the argument type is 'signed int'. [invalidPrintfArgType_s]\n"
"[test.cpp:17:5]: (warning) sprintf_s format string requires 5 parameters but 6 are given. [wrongPrintfScanfArgNum]\n", errout_str());

check("int main()\n"

@chrchr-github chrchr-github Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This test seems redundant and also ineffective since windows.cfg is not loaded.

Edit: scratch that, those are tests of the Windows functions. So the test in windows.cpp might as well be removed.

Comment thread test/cfg/windows.cpp
const size_t buffer_size = 64;
char buffer[buffer_size];
int precision = 2;
// cppcheck-suppress [checkLibraryFunction,valueFlowBailoutIncompleteVar]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If you want to go the extra mile, adding configuration for those two function would be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants