Skip to content

Commit 7859c52

Browse files
authored
Merge pull request github#5085 from geoffw0/msprintf2
C++: Fix FormattingFunction regression.
2 parents f1a0ec2 + 7087904 commit 7859c52

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)