From 305d79846f1d5f43ae5c9d763f6a953d5777618f Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 31 Jan 2024 14:30:50 +0100 Subject: [PATCH] Fixes #5619 --- lib/core/datatype.py | 13 ++++++++----- lib/core/settings.py | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/core/datatype.py b/lib/core/datatype.py index d595f905d..866b11420 100644 --- a/lib/core/datatype.py +++ b/lib/core/datatype.py @@ -6,6 +6,7 @@ See the file 'LICENSE' for copying permission """ import copy +import threading import types from thirdparty.odict import OrderedDict @@ -142,6 +143,7 @@ class LRUDict(object): def __init__(self, capacity): self.capacity = capacity self.cache = OrderedDict() + self.__lock = threading.Lock() def __len__(self): return len(self.cache) @@ -158,11 +160,12 @@ class LRUDict(object): return self.__getitem__(key) def __setitem__(self, key, value): - try: - self.cache.pop(key) - except KeyError: - if len(self.cache) >= self.capacity: - self.cache.popitem(last=False) + with self.__lock: + try: + self.cache.pop(key) + except KeyError: + if len(self.cache) >= self.capacity: + self.cache.popitem(last=False) self.cache[key] = value def set(self, key, value): diff --git a/lib/core/settings.py b/lib/core/settings.py index 999d30590..162c1bc59 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -20,7 +20,7 @@ from thirdparty import six from thirdparty.six import unichr as _unichr # sqlmap version (...) -VERSION = "1.8.1.6" +VERSION = "1.8.1.7" 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)