summaryrefslogtreecommitdiff
path: root/json_tokener.c
diff options
context:
space:
mode:
authorEric Haszlakiewicz <erh+git@nimenees.com>2020-04-20 16:06:34 +0000
committerEric Haszlakiewicz <erh+git@nimenees.com>2020-04-21 03:53:44 +0000
commitf6f76f9430f0f468a18c937fa7fdd9bf84041d8a (patch)
tree472f85b7469f82af0c21afbfdcb73379a0e96f06 /json_tokener.c
parent05623b3a2e2248b75ffa689d00701def81e39d70 (diff)
downloadjson-c-f6f76f9430f0f468a18c937fa7fdd9bf84041d8a.tar.gz
Add a JSON_TOKENER_ALLOW_TRAILING_CHARS flag for json_tokener_set_flags() to allow multiple objects to be parsed from input even when JSON_TOKENER_STRICT is set.
Diffstat (limited to 'json_tokener.c')
-rw-r--r--json_tokener.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/json_tokener.c b/json_tokener.c
index 840ad12..40933ff 100644
--- a/json_tokener.c
+++ b/json_tokener.c
@@ -25,7 +25,6 @@
#include <stdlib.h>
#include <string.h>
-#include "arraylist.h"
#include "debug.h"
#include "json_inttypes.h"
#include "json_object.h"
@@ -1130,7 +1129,7 @@ out:
tok->err = json_tokener_error_parse_utf8_string;
}
if (c && (state == json_tokener_state_finish) && (tok->depth == 0) &&
- (tok->flags & JSON_TOKENER_STRICT))
+ (tok->flags & (JSON_TOKENER_STRICT|JSON_TOKENER_ALLOW_TRAILING_CHARS)) == JSON_TOKENER_STRICT)
{
/* unexpected char after JSON data */
tok->err = json_tokener_error_parse_unexpected;