@@ -91,15 +91,16 @@ predicate isNonConst(DataFlow::Node node, boolean isIndirect) {
9191 )
9292 )
9393 or
94- exists ( UncalledFunction f , Parameter p | f .getAParameter ( ) = p |
95- p = e .( VariableAccess ) .getTarget ( ) )
96- or
94+ exists ( UncalledFunction f , Parameter p | f .getAParameter ( ) = p |
95+ p = e .( VariableAccess ) .getTarget ( )
96+ )
97+ or
9798 node instanceof FlowSource
9899 or
99- (
100- node instanceof DataFlow :: DefinitionByReferenceNode and
101- not exists ( FormattingFunctionCall fc | node . asDefiningArgument ( ) = fc . getOutputArgument ( _ ) ) and
102- not exists ( Call c | c .getAnArgument ( ) = node .asDefiningArgument ( ) and c .getTarget ( ) .hasDefinition ( ) )
100+ node instanceof DataFlow :: DefinitionByReferenceNode and
101+ not exists ( FormattingFunctionCall fc | node . asDefiningArgument ( ) = fc . getOutputArgument ( _ ) ) and
102+ not exists ( Call c |
103+ c .getAnArgument ( ) = node .asDefiningArgument ( ) and c .getTarget ( ) .hasDefinition ( )
103104 )
104105 )
105106 or
@@ -121,15 +122,7 @@ predicate isSinkImpl(DataFlow::Node sink, Expr formatString) {
121122}
122123
123124module NonConstFlowConfig implements DataFlow:: ConfigSig {
124- predicate isSource ( DataFlow:: Node source ) {
125- // isNonConst(source)
126- isNonConst ( source , _)
127- // exists(boolean isIndirect, Type t |
128- // isNonConst(source, isIndirect) and
129- // t = source.getType() and
130- // not cannotContainString(t, isIndirect)
131- // )
132- }
125+ predicate isSource ( DataFlow:: Node source ) { isNonConst ( source , _) }
133126
134127 predicate isSink ( DataFlow:: Node sink ) { isSinkImpl ( sink , _) }
135128
@@ -138,17 +131,10 @@ module NonConstFlowConfig implements DataFlow::ConfigSig {
138131
139132module NonConstFlow = TaintTracking:: Global< NonConstFlowConfig > ;
140133
141- // import NonConstFlow::PathGraph
142-
143- from
144- FormattingFunctionCall call , Expr formatString , DataFlow:: Node sink
145- // ,NonConstFlow::PathNode src,
146- // NonConstFlow::PathNode sink
134+ from FormattingFunctionCall call , Expr formatString , DataFlow:: Node sink
147135where
148136 call .getArgument ( call .getFormatParameterIndex ( ) ) = formatString and
149- //NonConstFlow::flowPath(src, sink) and
150137 NonConstFlow:: flowTo ( sink ) and
151- //isSinkImpl(sink.getNode(), formatString)
152138 isSinkImpl ( sink , formatString )
153139select formatString , //sink.getNode(), src, sink,
154140 "The format string argument to " + call .getTarget ( ) .getName ( ) +
0 commit comments