Fix NUL byte check for object keys
This commit is contained in:
parent
78a80b8899
commit
4d5aead31c
@ -699,7 +699,7 @@ static json_t *parse_object(lex_t *lex, size_t flags, json_error_t *error)
|
||||
key = lex_steal_string(lex, &len);
|
||||
if(!key)
|
||||
return NULL;
|
||||
if (memchr(key, len, '\0')) {
|
||||
if (memchr(key, '\0', len)) {
|
||||
jsonp_free(key);
|
||||
error_set(error, lex, "NUL byte in object key not supported");
|
||||
goto error;
|
||||
|
2
test/suites/invalid/null-byte-in-object-key/error
Normal file
2
test/suites/invalid/null-byte-in-object-key/error
Normal file
@ -0,0 +1,2 @@
|
||||
1 15 15
|
||||
NUL byte in object key not supported near '"foo\u0000bar"'
|
1
test/suites/invalid/null-byte-in-object-key/input
Normal file
1
test/suites/invalid/null-byte-in-object-key/input
Normal file
@ -0,0 +1 @@
|
||||
{"foo\u0000bar": 42}
|
Loading…
Reference in New Issue
Block a user