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

Skip to content

Commit 65130c4

Browse files
committed
[CPP-340] Add white list (for false positive suppression) to TooManyArguments.ql
1 parent 61c91b6 commit 65130c4

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

cpp/ql/src/Likely Bugs/Underspecified Functions/TooManyArguments.ql

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,24 @@ predicate isCompiledAsC(Function f) {
2727
)
2828
}
2929

30+
predicate isWhitelisted(Function f) {
31+
f instanceof BuiltInFunction
32+
or
33+
// The following list can be expanded as the need arises
34+
exists(string name | name = f.getName() |
35+
name = "static_assert" or
36+
name = "_Static_assert" or
37+
name = "strptime"
38+
)
39+
}
40+
3041
from FunctionCall fc, Function f
3142
where
3243
f = fc.getTarget() and
3344
not f.isVarargs() and
34-
not f instanceof BuiltInFunction and
3545
hasZeroParamDecl(f) and
3646
isCompiledAsC(f) and
47+
not isWhitelisted(f) and
3748
// There must not exist a declaration with the number of parameters
3849
// at least as large as the number of call arguments
3950
not exists(FunctionDeclarationEntry fde | fde = f.getADeclarationEntry() |

0 commit comments

Comments
 (0)