Skip to content

Commit 331fab5

Browse files
committed
C++: Generalize the ArgvSource flow source
This matches `isUserInput` and handles cases where `argv` has a different name, which is allowed.
1 parent 7d1f10b commit 331fab5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cpp/ql/lib/semmle/code/cpp/security/FlowSources.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ private class LocalParameterSource extends LocalFlowSource {
8989

9090
private class ArgvSource extends LocalFlowSource {
9191
ArgvSource() {
92-
exists(Parameter argv |
93-
argv.hasName("argv") and
94-
argv.getFunction().hasGlobalName("main") and
92+
exists(Function main, Parameter argv |
93+
main.hasGlobalName("main") and
94+
main.getParameter(1) = argv and
9595
this.asExpr() = argv.getAnAccess()
9696
)
9797
}

0 commit comments

Comments
 (0)