Skip to content

Commit d93d22b

Browse files
committed
C++: Fix FPs in 'cpp/non-constant-format'.
1 parent 1e5b235 commit d93d22b

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

cpp/ql/src/Likely Bugs/Format/NonConstantFormat.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ predicate isNonConst(DataFlow::Node node, boolean isIndirect) {
121121

122122
pragma[noinline]
123123
predicate isSanitizerNode(DataFlow::Node node) {
124-
underscoreMacro(node.asExpr())
124+
underscoreMacro([node.asExpr(), node.asIndirectExpr()])
125125
or
126126
exists(node.asExpr()) and
127127
cannotContainString(node.getType(), false)

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
| NonConstantFormat.c:30:10:30:16 | access to array | The format string argument to printf should be constant to prevent security issues and other potential errors. |
2-
| NonConstantFormat.c:34:9:34:36 | call to any_random_function | The format string argument to printf should be constant to prevent security issues and other potential errors. |
32
| NonConstantFormat.c:41:9:41:27 | call to any_random_function | The format string argument to printf should be constant to prevent security issues and other potential errors. |
4-
| NonConstantFormat.c:45:9:45:48 | call to any_random_function | The format string argument to printf should be constant to prevent security issues and other potential errors. |
53
| nested.cpp:21:23:21:26 | fmt0 | The format string argument to snprintf should be constant to prevent security issues and other potential errors. |
64
| nested.cpp:79:32:79:38 | call to get_fmt | The format string argument to diagnostic should be constant to prevent security issues and other potential errors. |
75
| nested.cpp:87:18:87:20 | fmt | The format string argument to diagnostic should be constant to prevent security issues and other potential errors. |

0 commit comments

Comments
 (0)