mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
C++: Test for erroneous string types
This commit is contained in:
@@ -1 +1,2 @@
|
||||
| tests.c:7:18:7:18 | 1 | This format specifier for type 'char *' does not match the argument type 'int'. |
|
||||
| tests.c:11:18:11:20 | str | This format specifier for type 'char *' does not match the argument type '<error-type> *'. |
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
int printf(const char * format, ...);
|
||||
int fprintf();
|
||||
|
||||
void f() {
|
||||
void f(UNKNOWN_CHAR * str) {
|
||||
printf("%s", 1); // BAD
|
||||
printf("%s", implicit_function()); // GOOD - we should ignore the type
|
||||
sprintf(0, "%s", ""); // GOOD
|
||||
fprintf(0, "%s", ""); // GOOD
|
||||
printf("%s", str); // GOOD - erroneous type is ignored
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user