Contact Information
No response
MaxKB Version
MaxKB 2.10.4-lts
Problem Description
In apps/common/utils/common.py:443, s_list = ["\\u0000"] is a 6-character literal
string (backslash + "u0000"), not the actual NUL byte. .replace() therefore never
matches a real NUL byte, so NUL characters pass through the "special character filter".
This function is used to sanitize user/content input, so NUL bytes survive cleansing.
Steps to Reproduce
- Call filter_special_character("a\x00b") # input contains a real NUL byte
- Inspect the return value
The expected correct result
Expected Result
Return "ab" (the NUL byte is removed).
Actual Result (error log / stacktrace)
Return value is 'a\x00b' unchanged — the NUL byte is still present.
Reproduced by executing the real source function:
input repr: 'a\x00b' (len 3)
output repr: 'a\x00b' (len 3)
NUL byte still present after filter?: True
Related log output
Additional Information
Suggested Fix (optional)
- Line 443: change
s_list = ["\\u0000"] to s_list = ["\u0000"]
(single backslash so Python decodes it as the NUL byte), or use:
s_list = ["\x00"].
在Python中:
"\u0000" 是转义后的反斜杠加上字面文本 u0000,即字符串 \u0000(6个字符:, u, 0, 0, 0, 0)。
真正的NUL字节应写作 "\u0000"(不加双反斜杠),是单个字符 \x00。
因此,当调用 filter_special_character("a\x00b") 时,输入中包含的是真正的NUL字节 (\x00),而代码尝试替换的是字面字符串 "\u0000",二者完全不匹配,.replace() 不会有任何效果。
Contact Information
No response
MaxKB Version
MaxKB 2.10.4-lts
Problem Description
In apps/common/utils/common.py:443,
s_list = ["\\u0000"]is a 6-character literalstring (backslash + "u0000"), not the actual NUL byte.
.replace()therefore nevermatches a real NUL byte, so NUL characters pass through the "special character filter".
This function is used to sanitize user/content input, so NUL bytes survive cleansing.
Steps to Reproduce
The expected correct result
Expected Result
Return "ab" (the NUL byte is removed).
Actual Result (error log / stacktrace)
Return value is 'a\x00b' unchanged — the NUL byte is still present.
Reproduced by executing the real source function:
input repr: 'a\x00b' (len 3)
output repr: 'a\x00b' (len 3)
NUL byte still present after filter?: True
Related log output
Additional Information
Suggested Fix (optional)
s_list = ["\\u0000"]tos_list = ["\u0000"](single backslash so Python decodes it as the NUL byte), or use:
s_list = ["\x00"].在Python中:
"\u0000" 是转义后的反斜杠加上字面文本 u0000,即字符串 \u0000(6个字符:, u, 0, 0, 0, 0)。
真正的NUL字节应写作 "\u0000"(不加双反斜杠),是单个字符 \x00。
因此,当调用 filter_special_character("a\x00b") 时,输入中包含的是真正的NUL字节 (\x00),而代码尝试替换的是字面字符串 "\u0000",二者完全不匹配,.replace() 不会有任何效果。