Skip to content

Commit 7087904

Browse files
committed
C++: Solution.
1 parent 1fd2449 commit 7087904

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cpp/ql/src/semmle/code/cpp/commons/Printf.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ predicate primitiveVariadicFormatter(
5353
(
5454
if type = "" then outputParamIndex = -1 else outputParamIndex = 0 // Conveniently, these buffer parameters are all at index 0.
5555
) and
56-
not exists(f.getBlock()) // exclude functions with an implementation in the snapshot as they may not be standard implementations.
56+
not (
57+
// exclude functions with an implementation in the snapshot source
58+
// directory, as they may not be standard implementations.
59+
exists(f.getBlock()) and
60+
exists(f.getFile().getRelativePath())
61+
)
5762
}
5863

5964
private predicate callsVariadicFormatter(

0 commit comments

Comments
 (0)