C++: Add wrong format type builtin function test

This commit is contained in:
Jeroen Ketema
2024-10-25 16:16:13 +02:00
parent ab1b48d687
commit ccc2a39abc
3 changed files with 7 additions and 0 deletions

View File

@@ -0,0 +1 @@
| tests.c:3:74:3:74 | 1 | This format specifier for type 'char *' does not match the argument type 'int'. |

View File

@@ -0,0 +1 @@
Likely Bugs/Format/WrongTypeFormatArguments.ql

View File

@@ -0,0 +1,5 @@
void f() {
char buf[35];
__builtin___sprintf_chk(buf, 0, __builtin_object_size(buf, 1), "%s", 1);
__builtin___sprintf_chk(buf, 0, __builtin_object_size(buf, 1), "%d", 1);
}