Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c47061f

Browse files
committed
Update regarding #4281
1 parent 9b871f1 commit c47061f

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

lib/core/decorators.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,19 @@ def cachedmethod(f):
3939

4040
@functools.wraps(f)
4141
def _f(*args, **kwargs):
42-
key = int(hashlib.md5("|".join(str(_) for _ in (f, args, kwargs)).encode(UNICODE_ENCODING)).hexdigest(), 16) & 0x7fffffffffffffff
43-
4442
try:
45-
with _cache_lock:
46-
result = _cache[f][key]
47-
except KeyError:
43+
key = int(hashlib.md5("|".join(str(_) for _ in (f, args, kwargs)).encode(UNICODE_ENCODING)).hexdigest(), 16) & 0x7fffffffffffffff
44+
except ValueError: # https://github.com/sqlmapproject/sqlmap/issues/4281 (NOTE: non-standard Python behavior where hexdigest returns binary value)
4845
result = f(*args, **kwargs)
49-
50-
with _cache_lock:
51-
_cache[f][key] = result
46+
else:
47+
try:
48+
with _cache_lock:
49+
result = _cache[f][key]
50+
except KeyError:
51+
result = f(*args, **kwargs)
52+
53+
with _cache_lock:
54+
_cache[f][key] = result
5255

5356
return result
5457

lib/core/settings.py

Lines changed: 1 addition & 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.4.7.17"
21+
VERSION = "1.4.7.18"
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)

0 commit comments

Comments
 (0)