@@ -23,7 +23,7 @@ private class RemoteReturnSource extends RemoteFlowSource {
2323 string sourceType ;
2424
2525 RemoteReturnSource ( ) {
26- exists ( RemoteFlowFunction func , CallInstruction instr , FunctionOutput output |
26+ exists ( RemoteFlowSourceFunction func , CallInstruction instr , FunctionOutput output |
2727 asInstruction ( ) = instr and
2828 instr .getStaticCallTarget ( ) = func and
2929 func .hasRemoteFlowSource ( output , sourceType ) and
@@ -42,7 +42,7 @@ private class RemoteParameterSource extends RemoteFlowSource {
4242 string sourceType ;
4343
4444 RemoteParameterSource ( ) {
45- exists ( RemoteFlowFunction func , WriteSideEffectInstruction instr , FunctionOutput output |
45+ exists ( RemoteFlowSourceFunction func , WriteSideEffectInstruction instr , FunctionOutput output |
4646 asInstruction ( ) = instr and
4747 instr .getPrimaryInstruction ( ) .( CallInstruction ) .getStaticCallTarget ( ) = func and
4848 func .hasRemoteFlowSource ( output , sourceType ) and
@@ -57,7 +57,7 @@ private class LocalReturnSource extends LocalFlowSource {
5757 string sourceType ;
5858
5959 LocalReturnSource ( ) {
60- exists ( LocalFlowFunction func , CallInstruction instr , FunctionOutput output |
60+ exists ( LocalFlowSourceFunction func , CallInstruction instr , FunctionOutput output |
6161 asInstruction ( ) = instr and
6262 instr .getStaticCallTarget ( ) = func and
6363 func .hasLocalFlowSource ( output , sourceType ) and
@@ -76,7 +76,7 @@ private class LocalParameterSource extends LocalFlowSource {
7676 string sourceType ;
7777
7878 LocalParameterSource ( ) {
79- exists ( LocalFlowFunction func , WriteSideEffectInstruction instr , FunctionOutput output |
79+ exists ( LocalFlowSourceFunction func , WriteSideEffectInstruction instr , FunctionOutput output |
8080 asInstruction ( ) = instr and
8181 instr .getPrimaryInstruction ( ) .( CallInstruction ) .getStaticCallTarget ( ) = func and
8282 func .hasLocalFlowSource ( output , sourceType ) and
@@ -98,3 +98,31 @@ private class ArgvSource extends LocalFlowSource {
9898
9999 override string getSourceType ( ) { result = "a command-line argument" }
100100}
101+
102+ /** A remote data flow sink. */
103+ abstract class RemoteFlowSink extends DataFlow:: Node {
104+ /** Gets a string that describes the type of this flow sink. */
105+ abstract string getSinkType ( ) ;
106+ }
107+
108+ private class RemoteParameterSink extends RemoteFlowSink {
109+ string sourceType ;
110+
111+ RemoteParameterSink ( ) {
112+ exists ( RemoteFlowSinkFunction func , FunctionInput input , CallInstruction call , int index |
113+ func .hasRemoteFlowSink ( input , sourceType ) and call .getStaticCallTarget ( ) = func
114+ |
115+ exists ( ReadSideEffectInstruction read |
116+ call = read .getPrimaryInstruction ( ) and
117+ read .getIndex ( ) = index and
118+ this .asOperand ( ) = read .getSideEffectOperand ( ) and
119+ input .isParameterDerefOrQualifierObject ( index )
120+ )
121+ or
122+ input .isParameterOrQualifierAddress ( index ) and
123+ this .asOperand ( ) = call .getArgumentOperand ( index )
124+ )
125+ }
126+
127+ override string getSinkType ( ) { result = sourceType }
128+ }
0 commit comments