Skip to content

Commit 938d953

Browse files
committed
Refactor getLeftmostOperand method
1 parent 5ff4fcb commit 938d953

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

java/ql/src/Security/CWE/CWE-522/InsecureLdapAuth.ql

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,13 @@ predicate concatInsecureLdapString(Expr protocol, Expr host) {
5353

5454
/** Gets the leftmost operand in a concatenated string */
5555
Expr getLeftmostConcatOperand(Expr expr) {
56+
// if expr instanceof AddExpr
57+
// then result = getLeftmostConcatOperand(expr.(AddExpr).getLeftOperand())
58+
// else result = expr
5659
if expr instanceof AddExpr
57-
then result = getLeftmostConcatOperand(expr.(AddExpr).getLeftOperand())
60+
then
61+
result = expr.(AddExpr).getLeftOperand*() and
62+
not result instanceof AddExpr
5863
else result = expr
5964
}
6065

0 commit comments

Comments
 (0)