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

Skip to content

Commit 0410ed7

Browse files
committed
Adding exclusion for main's argv (I believe this and other changes were accidentally removed in prior merge with other non-const branches)
1 parent 9f3dd63 commit 0410ed7

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ predicate isNonConst(DataFlow::Node node) {
6969
// Parameters of uncalled functions that aren't const
7070
exists(UncalledFunction f, Parameter p |
7171
f.getAParameter() = p and
72-
p = node.asParameter()
72+
p = node.asParameter() and
73+
// Ignore main's argv parameter as it is already considered a `FlowSource`
74+
// not ignoring it will result in path redundancies
75+
(f.getName() = "main" implies p.getName() != "argv")
7376
)
7477
or
7578
// Consider as an input any out arg of a function or a function's return where the function is not:

0 commit comments

Comments
 (0)