Skip to content

Commit 3f3ddd5

Browse files
committed
fix for that SELECT DISTINCT(LENGTH(...)) "misbehavior"
1 parent 8593741 commit 3f3ddd5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/utils/resume.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
from lib.core.common import dataToSessionFile
2828
from lib.core.common import safeStringFormat
29+
from lib.core.common import randomStr
2930
from lib.core.data import conf
3031
from lib.core.data import kb
3132
from lib.core.data import logger
@@ -62,7 +63,9 @@ def queryOutputLength(expression, payload):
6263
if ( select and re.search("\A(COUNT|LTRIM)\(", regExpr, re.I) ) or len(regExpr) <= 1:
6364
return None, None, None
6465

65-
if select:
66+
if selectDistinctExpr:
67+
lengthExpr = "SELECT %s FROM (%s) AS T%s" % (lengthQuery % regExpr, expression, randomStr(4))
68+
elif select:
6669
lengthExpr = expression.replace(regExpr, lengthQuery % regExpr, 1)
6770
else:
6871
lengthExpr = lengthQuery % expression
@@ -82,7 +85,7 @@ def queryOutputLength(expression, payload):
8285

8386
if length == " ":
8487
length = 0
85-
88+
8689
return count, length, regExpr
8790

8891
def resume(expression, payload):

0 commit comments

Comments
 (0)