@@ -27,15 +27,14 @@ abstract class SqlSink extends DataFlow::Node { }
2727class CApiSqlSink extends SqlSink {
2828 CApiSqlSink ( ) {
2929 // `sqlite3_exec` and variants of `sqlite3_prepare`.
30- exists ( AbstractFunctionDecl f , CallExpr call |
31- f .getName ( ) =
30+ exists ( CallExpr call |
31+ call . getStaticTarget ( ) .getName ( ) =
3232 [
3333 "sqlite3_exec(_:_:_:_:_:)" , "sqlite3_prepare(_:_:_:_:_:)" ,
3434 "sqlite3_prepare_v2(_:_:_:_:_:)" , "sqlite3_prepare_v3(_:_:_:_:_:_:)" ,
3535 "sqlite3_prepare16(_:_:_:_:_:)" , "sqlite3_prepare16_v2(_:_:_:_:_:)" ,
3636 "sqlite3_prepare16_v3(_:_:_:_:_:_:)"
3737 ] and
38- call .getStaticTarget ( ) = f and
3938 call .getArgument ( 1 ) .getExpr ( ) = this .asExpr ( )
4039 )
4140 }
@@ -47,16 +46,17 @@ class CApiSqlSink extends SqlSink {
4746class SQLiteSwiftSqlSink extends SqlSink {
4847 SQLiteSwiftSqlSink ( ) {
4948 // Variants of `Connection.execute`, `connection.prepare` and `connection.scalar`.
50- exists ( MethodDecl f , CallExpr call |
51- f .hasQualifiedName ( "Connection" , [ "execute(_:)" , "prepare(_:_:)" , "run(_:_:)" , "scalar(_:_:)" ] ) and
52- call .getStaticTarget ( ) = f and
49+ exists ( CallExpr call |
50+ call .getStaticTarget ( )
51+ .( MethodDecl )
52+ .hasQualifiedName ( "Connection" ,
53+ [ "execute(_:)" , "prepare(_:_:)" , "run(_:_:)" , "scalar(_:_:)" ] ) and
5354 call .getArgument ( 0 ) .getExpr ( ) = this .asExpr ( )
5455 )
5556 or
5657 // String argument to the `Statement` constructor.
57- exists ( MethodDecl f , CallExpr call |
58- f .hasQualifiedName ( "Statement" , "init(_:_:)" ) and
59- call .getStaticTarget ( ) = f and
58+ exists ( CallExpr call |
59+ call .getStaticTarget ( ) .( MethodDecl ) .hasQualifiedName ( "Statement" , "init(_:_:)" ) and
6060 call .getArgument ( 1 ) .getExpr ( ) = this .asExpr ( )
6161 )
6262 }
0 commit comments