From: Mikael Magnusson <mi...@users.sourceforge.net>

Don't stop array parsing if the chunk happens to end at an object boundary.

Fixes FS#3683: jsonfilter yields unreliable results

Signed-off-by: Mikael Magnusson <mi...@users.sourceforge.net>
---
 main.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/main.c b/main.c
index 5041d10..1e3665e 100644
--- a/main.c
+++ b/main.c
@@ -146,8 +146,12 @@ parse_json(FILE *fd, const char *source, const char 
**error, bool array_mode)
                {
                        obj = parse_json_chunk(tok, array, buf, len, &err);
 
-                       if (err == json_tokener_success && !array)
-                               break;
+                       if (err == json_tokener_success) {
+                               if (!array)
+                                       break;
+                               else
+                                       continue;
+                       }
 
                        if (err != json_tokener_continue)
                                break;
-- 
2.25.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to