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

Skip to content

Commit 03922aa

Browse files
committed
C++: Exclude custom vprintf implementations.
1 parent 527c415 commit 03922aa

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ predicate primitiveVariadicFormatter(
5050
then formatParamIndex = f.getNumberOfParameters() - 3
5151
else formatParamIndex = f.getNumberOfParameters() - 2
5252
) and
53-
if type = "" then outputParamIndex = -1 else outputParamIndex = 0 // Conveniently, these buffer parameters are all at index 0.
53+
(
54+
if type = "" then outputParamIndex = -1 else outputParamIndex = 0 // Conveniently, these buffer parameters are all at index 0.
55+
) and
56+
not exists(f.getBlock()) // exclude functions with an implementation in the snapshot as they may not be standard implementations.
5457
}
5558

5659
private predicate callsVariadicFormatter(

0 commit comments

Comments
 (0)