Skip to content

Commit 15dc083

Browse files
authored
Merge pull request #9747 from MathiasVP/fix-joins-in-swift-cwe-135
Swift: Don't join on index in `swift/string-length-conflation`
2 parents d285e19 + cc25e26 commit 15dc083

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

swift/ql/src/queries/Security/CWE-135/StringLengthConflation.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration {
6363
c.getAMember() = f and // TODO: will this even work if its defined in a parent class?
6464
call.getFunction().(ApplyExpr).getStaticTarget() = f and
6565
f.getName() = methodName and
66-
f.getParam(arg).getName() = paramName and
67-
call.getArgument(arg).getExpr() = node.asExpr() and
66+
f.getParam(pragma[only_bind_into](arg)).getName() = paramName and
67+
call.getArgument(pragma[only_bind_into](arg)).getExpr() = node.asExpr() and
6868
flowstate = "String" // `String` length flowing into `NSString`
6969
)
7070
or
@@ -74,8 +74,8 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration {
7474
funcName = "NSMakeRange(_:_:)" and
7575
paramName = ["loc", "len"] and
7676
call.getStaticTarget().getName() = funcName and
77-
call.getStaticTarget().getParam(arg).getName() = paramName and
78-
call.getArgument(arg).getExpr() = node.asExpr() and
77+
call.getStaticTarget().getParam(pragma[only_bind_into](arg)).getName() = paramName and
78+
call.getArgument(pragma[only_bind_into](arg)).getExpr() = node.asExpr() and
7979
flowstate = "String" // `String` length flowing into `NSString`
8080
)
8181
}

0 commit comments

Comments
 (0)