]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
in strick mode, number must not start with 0 90/head
authorRemi Collet <fedora@famillecollet.com>
Thu, 13 Jun 2013 11:40:01 +0000 (13:40 +0200)
committerRemi Collet <fedora@famillecollet.com>
Thu, 13 Jun 2013 11:40:01 +0000 (13:40 +0200)
json_tokener.c

index b2b47f9d8806eb33447613d376275c14e27f7728..4491cec2876a93b44612a4a5db76dad2e32318f1 100644 (file)
@@ -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);