@@ -58,24 +58,17 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration {
58
58
c .getAMember ( ) = f and // TODO: will this even work if its defined in a parent class?
59
59
call .getFunction ( ) .( ApplyExpr ) .getFunction ( ) .( DeclRefExpr ) .getDecl ( ) = f and
60
60
call .getFunction ( ) .( ApplyExpr ) .getFunction ( ) .toString ( ) = methodName and // TODO: use of toString
61
- call .getFunction ( )
62
- .( ApplyExpr )
63
- .getFunction ( )
64
- .( DeclRefExpr )
65
- .getDecl ( )
66
- .( AbstractFunctionDecl )
67
- .getParam ( arg )
68
- .getName ( ) = argName and
61
+ f .getParam ( arg ) .getName ( ) = argName and
69
62
call .getArgument ( arg ) .getExpr ( ) = node .asExpr ( ) and
70
63
flowstate = "String" // `String` length flowing into `NSString`
71
64
)
72
65
or
73
66
// arguments to function calls...
74
67
exists ( string funcName , string argName , CallExpr call , int arg |
75
68
// `NSMakeRange`
76
- funcName = "NSMakeRange" and
69
+ funcName = "NSMakeRange(_:_:) " and
77
70
argName = [ "loc" , "len" ] and
78
- call .getStaticTarget ( ) .getName ( ) . matches ( funcName + "%" ) and
71
+ call .getStaticTarget ( ) .getName ( ) = funcName and
79
72
call .getStaticTarget ( ) .getParam ( arg ) .getName ( ) = argName and
80
73
call .getArgument ( arg ) .getExpr ( ) = node .asExpr ( ) and
81
74
flowstate = "String" // `String` length flowing into `NSString`
@@ -85,4 +78,4 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration {
85
78
86
79
from StringLengthConflationConfiguration config , DataFlow:: PathNode source , DataFlow:: PathNode sink
87
80
where config .hasFlowPath ( source , sink )
88
- select sink , source , sink , "RESULT"
81
+ select sink . getNode ( ) , source , sink , "RESULT"
0 commit comments