Skip to content

Commit ccbc3e6

Browse files
committed
First patch for sqlmapproject#4530
1 parent f84ec10 commit ccbc3e6

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

lib/core/settings.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty.six import unichr as _unichr
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.5.1.12"
21+
VERSION = "1.5.1.13"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
@@ -757,6 +757,8 @@
757757
# For preventing MemoryError exceptions (caused when using large sequences in difflib.SequenceMatcher)
758758
MAX_DIFFLIB_SEQUENCE_LENGTH = 10 * 1024 * 1024
759759

760+
MAX_CHAR_HEURISTICS_SIZE = 10000
761+
760762
# Maximum (multi-threaded) length of entry in bisection algorithm
761763
MAX_BISECTION_LENGTH = 50 * 1024 * 1024
762764

lib/request/basic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
from lib.core.settings import DEFAULT_COOKIE_DELIMITER
4545
from lib.core.settings import EVENTVALIDATION_REGEX
4646
from lib.core.settings import IDENTYWAF_PARSE_LIMIT
47+
from lib.core.settings import MAX_CHAR_HEURISTICS_SIZE
4748
from lib.core.settings import MAX_CONNECTION_TOTAL_SIZE
4849
from lib.core.settings import META_CHARSET_REGEX
4950
from lib.core.settings import PARSE_HEADERS_LIMIT
@@ -258,7 +259,7 @@ def getHeuristicCharEncoding(page):
258259
"""
259260

260261
key = hash(page)
261-
retVal = kb.cache.encoding.get(key) or detect(page)["encoding"]
262+
retVal = kb.cache.encoding.get(key) or detect(page[:MAX_CHAR_HEURISTICS_SIZE])["encoding"]
262263
kb.cache.encoding[key] = retVal
263264

264265
if retVal and retVal.lower().replace('-', "") == UNICODE_ENCODING.lower().replace('-', ""):

0 commit comments

Comments
 (0)