Skip to content

Commit

Permalink
trailing char not allowed in strict mode
Browse files Browse the repository at this point in the history
  • Loading branch information
remicollet committed Aug 23, 2013
1 parent 87fa32d commit 4039f91
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions json_tokener.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4039f91

Please sign in to comment.