Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bd13823

Browse files
committed
CPP: Add a test of ODASA-3654.
1 parent 4075f57 commit bd13823

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

cpp/ql/test/query-tests/Likely Bugs/Format/WrongNumberOfFormatArguments/WrongNumberOfFormatArguments.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
| test.c:15:2:15:7 | call to printf | Format expects 3 arguments but given 2 |
77
| test.c:19:2:19:7 | call to printf | Format expects 2 arguments but given 1 |
88
| test.c:29:3:29:8 | call to printf | Format expects 2 arguments but given 1 |
9+
| test.c:44:2:44:7 | call to printf | Format expects 3 arguments but given 2 |

cpp/ql/test/query-tests/Likely Bugs/Format/WrongNumberOfFormatArguments/test.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,6 @@ void test(int i, const char *str)
4040
printf("%2$.*4$f", 0, num, 0, precision); // GOOD [FALSE POSITIVE]
4141
printf("%2$.*4$f", num, 0, precision); // BAD (too few format arguments) [INCORRECT MESSAGE]
4242
}
43+
44+
printf("%@ %i %i", 1, 2); // GOOD [FALSE POSITIVE]
4345
}

0 commit comments

Comments
 (0)