From 990ea5fe9722fadb3f51ca0cbe9d2a9c146b1536 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sun, 14 Apr 2019 01:34:06 -0500 Subject: [PATCH] Ignore garbage data after the json object. This should work around an issue (possible Marinetti bug?) where a portion of the beginning of the response could be erroneously repeated at the end of it. --- json.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/json.c b/json.c index 301b9ce..c0aa685 100644 --- a/json.c +++ b/json.c @@ -35,6 +35,8 @@ #endif #endif +#define JSON_ALLOW_TRAILING_GARBAGE 1 + const struct _json_value json_value_none; #include @@ -501,6 +503,7 @@ json_value * json_parse_ex (json_settings * settings, if (!b) break; +#ifndef JSON_ALLOW_TRAILING_GARBAGE switch (b) { whitespace: @@ -513,6 +516,9 @@ json_value * json_parse_ex (json_settings * settings, goto e_failed; }; +#else + continue; +#endif } if (flags & flag_seek_value)