Fixing MsSQL FOR JSON handling of NULL values

This commit is contained in:
Miroslav Štampar 2026-07-28 11:57:14 +02:00
parent 0ab84074f7
commit 18e06c6381
3 changed files with 73 additions and 2 deletions

View file

@ -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.215"
VERSION = "1.10.7.216"
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)

View file

@ -125,7 +125,8 @@ def _oneShotUnionUse(expression, unpack=True, limited=False):
if fields:
parts = []
for row in json_data:
parts.append("%s%s%s" % (kb.chars.start, kb.chars.delimiter.join(getUnicode(row.get(field) or NULL) for field in fields), kb.chars.stop))
# is-None (not falsy) check: a real 0 / '' / False are values, only JSON null is NULL
parts.append("%s%s%s" % (kb.chars.start, kb.chars.delimiter.join(NULL if row.get(field) is None else getUnicode(row.get(field)) for field in fields), kb.chars.stop))
retVal = "".join(parts)
except:
retVal = None