mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-08-04 14:55:40 +00:00
Fixes potential collisions in list/tuple with cachedmethod
This commit is contained in:
parent
932a5bd7b2
commit
c78cd5c43e
2 changed files with 8 additions and 3 deletions
|
|
@ -15,6 +15,11 @@ from lib.core.threads import getCurrentThreadData
|
|||
_cache = {}
|
||||
_method_locks = {}
|
||||
|
||||
# Private marker prefixing the slow-path (frozen) cache key so it can never collide with a raw
|
||||
# fast-path key: without it e.g. args ([1,2],) freezes to ((1,2),), the exact fast key of ((1,2),),
|
||||
# and the two calls would share a cache slot and return each other's result
|
||||
_FROZEN_KEY_MARKER = object()
|
||||
|
||||
def cachedmethod(f):
|
||||
"""
|
||||
Method with a cached content
|
||||
|
|
@ -62,9 +67,9 @@ def cachedmethod(f):
|
|||
# Note: fallback (slow-path) for unhashable arguments
|
||||
try:
|
||||
if kwargs:
|
||||
key = (_freeze(args), _freeze(kwargs))
|
||||
key = (_FROZEN_KEY_MARKER, _freeze(args), _freeze(kwargs))
|
||||
else:
|
||||
key = _freeze(args)
|
||||
key = (_FROZEN_KEY_MARKER, _freeze(args))
|
||||
|
||||
with lock:
|
||||
if key in cache:
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ from lib.core.enums import OS
|
|||
from thirdparty import six
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.10.7.127"
|
||||
VERSION = "1.10.7.128"
|
||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue