mirror of
https://github.com/github/codeql.git
synced 2026-05-02 20:25:13 +02:00
CPP: Annotate test.
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
| printf.cpp:43:29:43:35 | test | This argument should be of type 'char *' but is of type 'char16_t *' |
|
||||
| printf.cpp:50:29:50:35 | test | This argument should be of type 'char16_t *' but is of type 'wchar_t *' |
|
||||
| printf.cpp:45:29:45:35 | test | This argument should be of type 'char *' but is of type 'char16_t *' |
|
||||
| printf.cpp:52:29:52:35 | test | This argument should be of type 'char16_t *' but is of type 'wchar_t *' |
|
||||
|
||||
@@ -25,27 +25,29 @@ int swprintf(WCHAR *dest, WCHAR *format, ...) {
|
||||
|
||||
int sprintf(char *dest, char *format, ...);
|
||||
|
||||
// ---
|
||||
|
||||
void test1() {
|
||||
WCHAR string[20];
|
||||
|
||||
swprintf(string, u"test %s", u"test");
|
||||
swprintf(string, u"test %s", u"test"); // GOOD
|
||||
}
|
||||
|
||||
void test2() {
|
||||
char string[20];
|
||||
|
||||
sprintf(string, "test %S", u"test");
|
||||
sprintf(string, "test %S", u"test"); // GOOD
|
||||
}
|
||||
|
||||
void test3() {
|
||||
char string[20];
|
||||
|
||||
sprintf(string, "test %s", u"test");
|
||||
sprintf(string, "test %s", u"test"); // BAD: `char16_t` string parameter read as `char` string
|
||||
}
|
||||
|
||||
|
||||
void test4() {
|
||||
char string[20];
|
||||
|
||||
sprintf(string, "test %S", L"test");
|
||||
sprintf(string, "test %S", L"test"); // BAD: `wchar_t` string parameter read as `char16_t` string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user