mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
C++: Add strcpy test for cpp/non-constant-format
This commit is contained in:
@@ -19,3 +19,4 @@
|
||||
| test.cpp:93:12:93:18 | ++ ... | The format string argument to printf should be constant to prevent security issues and other potential errors. |
|
||||
| test.cpp:110:12:110:24 | new[] | The format string argument to printf should be constant to prevent security issues and other potential errors. |
|
||||
| test.cpp:130:20:130:26 | access to array | The format string argument to sprintf should be constant to prevent security issues and other potential errors. |
|
||||
| test.cpp:157:12:157:15 | data | The format string argument to printf should be constant to prevent security issues and other potential errors. |
|
||||
|
||||
@@ -151,3 +151,8 @@ void print_ith_message() {
|
||||
set_value_of(&i);
|
||||
printf(messages[i], 1U); // GOOD
|
||||
}
|
||||
|
||||
void fmt_via_strcpy(char *data) {
|
||||
strcpy(data, "some string");
|
||||
printf(data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user