Reject raw NUL bytes in the parser instead of silently truncating tokens (#3606)

This commit is contained in:
august authored and GitHub committed 2026-08-24 00:01:54 +09:00
1 parent 8cf81cb80c
commit fbee8f48ba
2 files changed
+26

No files matched your search

+5
View File
@@ -563,6 +563,11 @@ typedef enum {
static chclass classify(char c) {
switch (c) {
case '\0':
// RFC 8259 forbids raw NUL in JSON text. Treating it as a literal lets it
// slip into the token buffer, where check_literal() reads the buffer as a
// NUL-terminated C string and silently truncates the token. Reject it.
return INVALID;
case ' ':
case '\t':
case '\r':