@@ -347,16 +347,6 @@ private class FileGetNameSanitizer extends PathInjectionSanitizer {
347
347
}
348
348
}
349
349
350
- /** Holds if `expr` may be null. */
351
- private predicate maybeNull ( Expr expr ) {
352
- exists ( DataFlow:: Node src , DataFlow:: Node sink |
353
- src .asExpr ( ) = nullExpr ( ) and
354
- sink .asExpr ( ) = expr
355
- |
356
- DataFlow:: localFlow ( src , sink )
357
- )
358
- }
359
-
360
350
/** Holds if `g` is a guard that checks for `..` components. */
361
351
private predicate pathTraversalGuard ( Guard g , Expr e , boolean branch ) {
362
352
// Local taint-flow is used here to handle cases where the validated expression comes from the
@@ -383,14 +373,13 @@ private class FileConstructorChildArgumentStep extends AdditionalTaintStep {
383
373
exists ( ConstructorCall constrCall |
384
374
constrCall .getConstructedType ( ) instanceof TypeFile and
385
375
n1 .asExpr ( ) = constrCall .getArgument ( 1 ) and
386
- n2 .asExpr ( ) = constrCall and
387
- (
388
- not n1 = DataFlow:: BarrierGuard< pathTraversalGuard / 3 > :: getABarrierNode ( ) and
389
- not n1 = ValidationMethod< pathTraversalGuard / 3 > :: getAValidatedNode ( ) and
390
- not TaintTracking:: localExprTaint ( any ( PathNormalizeSanitizer p ) , n1 .asExpr ( ) )
391
- or
392
- maybeNull ( constrCall .getArgument ( 0 ) )
393
- )
376
+ n2 .asExpr ( ) = constrCall
377
+ |
378
+ not n1 = DataFlow:: BarrierGuard< pathTraversalGuard / 3 > :: getABarrierNode ( ) and
379
+ not n1 = ValidationMethod< pathTraversalGuard / 3 > :: getAValidatedNode ( ) and
380
+ not TaintTracking:: localExprTaint ( any ( PathNormalizeSanitizer p ) , n1 .asExpr ( ) )
381
+ or
382
+ DataFlow:: localExprFlow ( nullExpr ( ) , constrCall .getArgument ( 0 ) )
394
383
)
395
384
}
396
385
}
0 commit comments