From 30c15be7aee30049a2edccc8e69595b13947e4fe Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 22 Oct 2018 13:11:05 +0100 Subject: [PATCH] json: properly handle EOF in json format --- lib/formats/json.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/formats/json.c b/lib/formats/json.c index 8edb89b44..d9c890f8d 100644 --- a/lib/formats/json.c +++ b/lib/formats/json.c @@ -333,6 +333,9 @@ int json_scan(struct io *io, struct sample *smps[], unsigned cnt) FILE *f = io_stream_input(io); for (i = 0; i < cnt; i++) { + if (feof(f)) + return -1; + skip: json = json_loadf(f, JSON_DISABLE_EOF_CHECK, &err); if (!json) break;