When JSON parsing fails, handle it gracefully, by printing an error message and returning immediately, instead of ending up segfaulting. Signed-off-by: Gergely Nagy <algernon@balabit.hu> --- modules/jsonparser/jsonparser.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/modules/jsonparser/jsonparser.c b/modules/jsonparser/jsonparser.c index 9347a5c..74e83a8 100644 --- a/modules/jsonparser/jsonparser.c +++ b/modules/jsonparser/jsonparser.c @@ -57,6 +57,12 @@ log_json_parser_process (LogParser *s, LogMessage *msg, const gchar *input) key = scratch_buffer_acquire (); value = scratch_buffer_acquire (); + if (!jso) + { + msg_error ("Unparsable JSON stream encountered", NULL); + return FALSE; + } + json_object_object_foreachC (jso, itr) { gboolean parsed = FALSE; -- 1.7.7.3