diff options
| author | Jo-Philipp Wich | 2024-01-23 07:55:43 +0000 |
|---|---|---|
| committer | Jo-Philipp Wich | 2024-01-23 07:55:43 +0000 |
| commit | 594cfa86469c005972ba750614f5b3f1af84d0f6 (patch) | |
| tree | 61839f6e5813ca1979df0e159f5aca1fcde82c90 | |
| parent | 013b75ab0598e84be84aa6eda79827c12265988f (diff) | |
| download | jsonpath-594cfa86469c005972ba750614f5b3f1af84d0f6.tar.gz | |
main: fix spurious premature parse aborts in array mode
When reading newline separated JSON (array mode), continue parsing even
if the JSON tokener signals success, as another object might follow.
Fixes: FS#3683
Fixes: openwrt#8703
Fixes: openwrt#11649
Fixes: openwrt#12344
Fixes: 8614470 ("main: implement array mode")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
| -rw-r--r-- | main.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -146,10 +146,8 @@ 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_continue) + if ((err == json_tokener_success && array_mode == false) || + (err != json_tokener_continue && err != json_tokener_success)) break; } } |