@@ -36,12 +36,9 @@ module ServerSideUrlRedirect {
3636 }
3737
3838 /**
39- * Gets a "prefix predecessor" of `nd`, that is, either a normal data flow predecessor
40- * or the left operand of `nd` if it is a concatenation.
39+ * Gets the left operand of `nd` if it is a concatenation.
4140 */
42- private DataFlow:: Node prefixPred ( DataFlow:: Node nd ) {
43- result = nd .getAPredecessor ( )
44- or
41+ private DataFlow:: Node getPrefixOperand ( DataFlow:: Node nd ) {
4542 exists ( Expr e | e instanceof AddExpr or e instanceof AssignAddExpr |
4643 nd = DataFlow:: valueNode ( e ) and
4744 result = DataFlow:: valueNode ( e .getChildExpr ( 0 ) )
@@ -53,7 +50,8 @@ module ServerSideUrlRedirect {
5350 */
5451 private DataFlow:: Node prefixCandidate ( Sink sink ) {
5552 result = sink or
56- result = prefixPred ( prefixCandidate ( sink ) )
53+ result = getPrefixOperand ( prefixCandidate ( sink ) ) or
54+ result = prefixCandidate ( sink ) .getAPredecessor ( )
5755 }
5856
5957 /**
@@ -62,7 +60,8 @@ module ServerSideUrlRedirect {
6260 private Expr getAPrefix ( Sink sink ) {
6361 exists ( DataFlow:: Node prefix |
6462 prefix = prefixCandidate ( sink ) and
65- not exists ( prefixPred ( prefix ) ) and
63+ not exists ( getPrefixOperand ( prefix ) ) and
64+ not exists ( prefix .getAPredecessor ( ) ) and
6665 result = prefix .asExpr ( )
6766 )
6867 }
0 commit comments