Skip to content

Commit cf53956

Browse files
authored
Merge pull request github#14021 from jketema/non-const-format-test
C++: Add `cpp/non-constant-format` test
2 parents 5734e47 + 6566b91 commit cf53956

File tree

1 file changed

+7
-0
lines changed
  • cpp/ql/test/query-tests/Likely Bugs/Format/NonConstantFormat

1 file changed

+7
-0
lines changed

cpp/ql/test/query-tests/Likely Bugs/Format/NonConstantFormat/test.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,10 @@ void fmt_via_strcpy(char *data) {
156156
strcpy(data, "some string");
157157
printf(data); // BAD
158158
}
159+
160+
void fmt_with_assignment() {
161+
const char *x, *y;
162+
163+
x = y = "a";
164+
printf(y); // GOOD
165+
}

0 commit comments

Comments
 (0)