@@ -81,47 +81,42 @@ module Fasthttp {
8181 }
8282 }
8383
84- private predicate responseBodyWriterResult ( DataFlow:: Node src ) {
85- exists ( Method responseBodyWriter |
86- responseBodyWriter .hasQualifiedName ( packagePath ( ) , "Response" , "BodyWriter" ) and
87- src = responseBodyWriter .getACall ( ) .getResult ( 0 )
88- )
89- }
90-
91- private module ResponseBodyWriterFlow = DataFlow:: SimpleGlobal< responseBodyWriterResult / 1 > ;
92-
9384 private class ResponseBody extends Http:: ResponseBody:: Range {
9485 DataFlow:: MethodCallNode call ;
95- string methodName ;
9686
9787 ResponseBody ( ) {
9888 exists ( Method m |
99- m .hasQualifiedName ( packagePath ( ) , "Response" , methodName ) and
89+ m .hasQualifiedName ( packagePath ( ) , "Response" ,
90+ [
91+ "AppendBody" , "AppendBodyString" , "SetBody" , "SetBodyRaw" , "SetBodyStream" ,
92+ "SetBodyString" , "Success" , "SuccessString"
93+ ] ) and
10094 call = m .getACall ( ) and
10195 this = call .getArgument ( 0 )
10296 or
10397 m .hasQualifiedName ( packagePath ( ) , "RequestCtx" , [ "Success" , "SuccessString" ] ) and
10498 call = m .getACall ( ) and
10599 this = call .getArgument ( 1 )
106- ) and
107- methodName =
108- [
109- "AppendBody" , "AppendBodyString" , "SetBody" , "SetBodyRaw" , "SetBodyStream" ,
110- "SetBodyString" , "Success" , "SuccessString"
111- ]
100+ )
101+ or
102+ exists ( Method responseBodyWriter , DataFlow:: CallNode writerCall |
103+ responseBodyWriter .hasQualifiedName ( packagePath ( ) , "Response" , "BodyWriter" ) and
104+ call = responseBodyWriter .getACall ( ) and
105+ writerCall = any ( Method write | write .hasQualifiedName ( "io" , "Writer" , "Write" ) ) .getACall ( ) and
106+ this = writerCall .getArgument ( 0 ) and
107+ DataFlow:: localFlow ( call .getResult ( 0 ) , writerCall .getReceiver ( ) )
108+ )
112109 or
113- exists ( Method write , DataFlow:: CallNode writeCall |
114- write .hasQualifiedName ( "io" , "Writer " , "Write " ) and
115- writeCall = write .getACall ( ) and
116- ResponseBodyWriterFlow :: flowsTo ( writeCall . getReceiver ( ) ) and
117- this = writeCall . getArgument ( 0 )
118- ) and
119- methodName = "BodyWriter"
110+ exists ( Method responseBodyWriter , DataFlow:: CallNode writerCall |
111+ responseBodyWriter .hasQualifiedName ( packagePath ( ) , "Response " , "BodyWriter " ) and
112+ call = responseBodyWriter .getACall ( ) and
113+ writerCall = any ( Function fprintf | fprintf . hasQualifiedName ( "fmt" , "Fprintf" ) ) . getACall ( ) and
114+ this = writerCall . getSyntacticArgument ( any ( int i | i > 1 ) ) and
115+ DataFlow :: localFlow ( call . getResult ( 0 ) , writerCall . getArgument ( 0 ) )
116+ )
120117 }
121118
122119 override Http:: ResponseWriter getResponseWriter ( ) { result .getANode ( ) = call .getReceiver ( ) }
123-
124- override string getAContentType ( ) { result = super .getAContentType ( ) }
125120 }
126121
127122 /**
0 commit comments