@@ -30,46 +30,46 @@ class StringLengthConflationConfiguration extends DataFlow::Configuration {
30
30
override predicate isSink ( DataFlow:: Node node , string flowstate ) {
31
31
// arguments to method calls...
32
32
exists (
33
- string className , string methodName , string argName , ClassDecl c , AbstractFunctionDecl f ,
33
+ string className , string methodName , string paramName , ClassDecl c , AbstractFunctionDecl f ,
34
34
CallExpr call , int arg
35
35
|
36
36
(
37
37
// `NSRange.init`
38
38
className = "NSRange" and
39
39
methodName = "init" and
40
- argName = [ "location" , "length" ]
40
+ paramName = [ "location" , "length" ]
41
41
or
42
42
// `NSString.character`
43
43
className = [ "NSString" , "NSMutableString" ] and
44
44
methodName = "character" and
45
- argName = "at"
45
+ paramName = "at"
46
46
or
47
47
// `NSString.character`
48
48
className = [ "NSString" , "NSMutableString" ] and
49
49
methodName = "substring" and
50
- argName = [ "from" , "to" ]
50
+ paramName = [ "from" , "to" ]
51
51
or
52
52
// `NSMutableString.insert`
53
53
className = "NSMutableString" and
54
54
methodName = "insert" and
55
- argName = "at"
55
+ paramName = "at"
56
56
) and
57
57
c .toString ( ) = className and // TODO: use of toString
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
- f .getParam ( arg ) .getName ( ) = argName and
61
+ f .getParam ( arg ) .getName ( ) = paramName and
62
62
call .getArgument ( arg ) .getExpr ( ) = node .asExpr ( ) and
63
63
flowstate = "String" // `String` length flowing into `NSString`
64
64
)
65
65
or
66
66
// arguments to function calls...
67
- exists ( string funcName , string argName , CallExpr call , int arg |
67
+ exists ( string funcName , string paramName , CallExpr call , int arg |
68
68
// `NSMakeRange`
69
69
funcName = "NSMakeRange(_:_:)" and
70
- argName = [ "loc" , "len" ] and
70
+ paramName = [ "loc" , "len" ] and
71
71
call .getStaticTarget ( ) .getName ( ) = funcName and
72
- call .getStaticTarget ( ) .getParam ( arg ) .getName ( ) = argName and
72
+ call .getStaticTarget ( ) .getParam ( arg ) .getName ( ) = paramName and
73
73
call .getArgument ( arg ) .getExpr ( ) = node .asExpr ( ) and
74
74
flowstate = "String" // `String` length flowing into `NSString`
75
75
)
0 commit comments