]> granicus.if.org Git - json-c/commitdiff
trailing char not allowed in strict mode
authorRemi Collet <fedora@famillecollet.com>
Fri, 23 Aug 2013 11:40:01 +0000 (13:40 +0200)
committerRemi Collet <fedora@famillecollet.com>
Fri, 23 Aug 2013 11:40:01 +0000 (13:40 +0200)
json_tokener.c

index 7ce53ca70677618a7e6a5e58ad4205015def8112..def6e1085161648a1f9a263ae2ebf047c57bc9de 100644 (file)
@@ -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)