Skip to content

Commit

Permalink
in strick mode, number must not start with 0
Browse files Browse the repository at this point in the history
  • Loading branch information
remicollet committed Jun 13, 2013
1 parent e48a25c commit e9ee4ae
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions json_tokener.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,11 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
int64_t num64;
double numd;
if (!tok->is_double && json_parse_int64(tok->pb->buf, &num64) == 0) {
if (num64 && tok->pb->buf[0]=='0' && (tok->flags & JSON_TOKENER_STRICT)) {
/* in strick mode, number must not start with 0 */
tok->err = json_tokener_error_parse_number;
goto out;
}
current = json_object_new_int64(num64);
} else if(tok->is_double && json_parse_double(tok->pb->buf, &numd) == 0) {
current = json_object_new_double(numd);
Expand Down

0 comments on commit e9ee4ae

Please sign in to comment.