Skip to content

Commit ede662e

Browse files
committed
Minor patch
1 parent dbe2734 commit ede662e

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty import six
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.10.8.4"
23+
VERSION = "1.10.8.5"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

plugins/dbms/mssqlserver/syntax.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,22 @@ def escape(expression, quote=True):
1616
True
1717
>>> Syntax.escape(u"SELECT 'abcd\xebfgh' FROM foobar") == "SELECT CHAR(97)+CHAR(98)+CHAR(99)+CHAR(100)+NCHAR(235)+CHAR(102)+CHAR(103)+CHAR(104) FROM foobar"
1818
True
19+
>>> Syntax.escape(u"SELECT '\U0001f600' FROM foobar") == "SELECT NCHAR(55357)+NCHAR(56832) FROM foobar"
20+
True
1921
"""
2022

2123
def escaper(value):
22-
return "+".join("%s(%d)" % ("CHAR" if _ < 128 else "NCHAR", _) for _ in getOrds(value))
24+
chars = []
25+
26+
for _ in getOrds(value):
27+
if _ < 128:
28+
chars.append("CHAR(%d)" % _)
29+
elif _ < 0x10000:
30+
chars.append("NCHAR(%d)" % _)
31+
else:
32+
_ -= 0x10000
33+
chars.append("NCHAR(%d)+NCHAR(%d)" % (0xd800 + (_ >> 10), 0xdc00 + (_ & 0x3ff))) # SQL Server's NCHAR() only accepts BMP values without SC collation, so split into a surrogate pair
34+
35+
return "+".join(chars)
2336

2437
return Syntax._escape(expression, quote, escaper)

0 commit comments

Comments
 (0)