mirror of
https://github.com/akheron/jansson.git
synced 2025-04-06 05:55:05 +00:00
Fix NUL byte check for object keys
This commit is contained in:
parent
78a80b8899
commit
4d5aead31c
3 changed files with 4 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue