Issue #867: disallow control characters in strict mode.

This commit is contained in:
Eric Hawicz
2024-09-02 09:43:04 -04:00
parent ecb7a4c9a3
commit 6bfab90c87
2 changed files with 45 additions and 1 deletions

View File

@@ -678,6 +678,12 @@ struct json_object *json_tokener_parse_ex(struct json_tokener *tok, const char *
state = json_tokener_state_string_escape;
break;
}
else if ((tok->flags & JSON_TOKENER_STRICT) && c <= 0x1f)
{
// Disallow control characters in strict mode
tok->err = json_tokener_error_parse_string;
goto out;
}
if (!ADVANCE_CHAR(str, tok) || !PEEK_CHAR(c, tok))
{
printbuf_memappend_checked(tok->pb, case_start,