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.

This commit is contained in:
Eric Haszlakiewicz
2020-04-20 16:06:34 +00:00
parent 05623b3a2e
commit f6f76f9430
5 changed files with 28 additions and 4 deletions

View File

@@ -144,12 +144,25 @@ typedef struct json_tokener json_tokener;
* restrictive from one release to the next, causing your
* code to fail on previously working input.
*
* Note that setting this will also effectively disable parsing
* of multiple json objects in a single character stream
* (e.g. {"foo":123}{"bar":234}); if you want to allow that
* also set JSON_TOKENER_ALLOW_TRAILING_CHARS
*
* This flag is not set by default.
*
* @see json_tokener_set_flags()
*/
#define JSON_TOKENER_STRICT 0x01
/**
* Use with JSON_TOKENER_STRICT to allow trailing characters after the
* first parsed object.
*
* @see json_tokener_set_flags()
*/
#define JSON_TOKENER_ALLOW_TRAILING_CHARS 0x02
/**
* Cause json_tokener_parse_ex() to validate that input is UTF8.
* If this flag is specified and validation fails, then