Fix NUL byte check for object keys

This commit is contained in:
Petri Lehtinen 2013-09-30 09:35:45 +03:00
parent 78a80b8899
commit 4d5aead31c
3 changed files with 4 additions and 1 deletions

View File

@ -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); key = lex_steal_string(lex, &len);
if(!key) if(!key)
return NULL; return NULL;
if (memchr(key, len, '\0')) { if (memchr(key, '\0', len)) {
jsonp_free(key); jsonp_free(key);
error_set(error, lex, "NUL byte in object key not supported"); error_set(error, lex, "NUL byte in object key not supported");
goto error; goto error;

View File

@ -0,0 +1,2 @@
1 15 15
NUL byte in object key not supported near '"foo\u0000bar"'

View File

@ -0,0 +1 @@
{"foo\u0000bar": 42}