diff options
author | Remi Collet <fedora@famillecollet.com> | 2013-08-23 13:40:01 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2013-08-23 13:40:01 +0200 |
commit | 4039f91cab283b483094dbe59202818bb1733d66 (patch) | |
tree | 712ccaf23d220c2aa755e8fe2a9d2b3c463cac83 | |
parent | 87fa32dfe013d961ced5252ffacef0beefc8f62f (diff) | |
download | json-c-4039f91cab283b483094dbe59202818bb1733d66.tar.gz |
trailing char not allowed in strict mode
-rw-r--r-- | json_tokener.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/json_tokener.c b/json_tokener.c index 7ce53ca..def6e10 100644 --- a/json_tokener.c +++ b/json_tokener.c @@ -769,6 +769,13 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok, } /* while(POP_CHAR) */ out: + if (c && + (state == json_tokener_state_finish) && + (tok->depth == 0) && + (tok->flags & JSON_TOKENER_STRICT)) { + /* unexpected char after JSON data */ + tok->err = json_tokener_error_parse_unexpected; + } if (!c) { /* We hit an eof char (0) */ if(state != json_tokener_state_finish && saved_state != json_tokener_state_finish) |