mirror of
https://github.com/github/codeql.git
synced 2026-04-24 00:05:14 +02:00
C++: Add test for cpp/wrong-type-format-argument
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
| tests.c:7:18:7:18 | 1 | This format specifier for type 'char *' does not match the argument type 'int'. |
|
||||
| tests.c:8:18:8:34 | call to implicit_function | This format specifier for type 'char *' does not match the argument type 'int'. |
|
||||
| tests.c:9:13:9:13 | 0 | This format specifier for type 'char *' does not match the argument type 'int'. |
|
||||
| tests.c:10:13:10:13 | 0 | This format specifier for type 'char *' does not match the argument type 'int'. |
|
||||
@@ -0,0 +1 @@
|
||||
Likely Bugs/Format/WrongTypeFormatArguments.ql
|
||||
@@ -0,0 +1,11 @@
|
||||
// semmle-extractor-options: --expect_errors
|
||||
|
||||
int printf(const char * format, ...);
|
||||
int fprintf();
|
||||
|
||||
int f() {
|
||||
printf("%s", 1); // BAD - TP
|
||||
printf("%s", implicit_function()); // BAD (FP) - we should not infer the return type
|
||||
sprintf(0, "%s", ""); // BAD (FP)
|
||||
fprintf(0, "%s", ""); // BAD (FP)
|
||||
}
|
||||
Reference in New Issue
Block a user