From 28ece127aee19881956c55c7f704f60682034dc8 Mon Sep 17 00:00:00 2001 From: Bodo Petermann Date: Mon, 17 Mar 2025 12:06:07 +0100 Subject: [PATCH] out_gelf: fix crash after missing short_message key Fix for an illegal free in the gelf output plugin when it handled a message lacking the short_message key. In `cb_gelf_flush`: if the input doesn't contain the short_message key `flb_msgpack_to_gelf` will fail and return NULL. The variable `s` is not initialized, but still `flb_sds_destroy(s)` is called which may unexpectedly free some arbitrary pointer. Fixed by initializing `s`. Fixes #10086 --- plugins/out_gelf/gelf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/out_gelf/gelf.c b/plugins/out_gelf/gelf.c index 0499cddc157..1d18ba0305d 100644 --- a/plugins/out_gelf/gelf.c +++ b/plugins/out_gelf/gelf.c @@ -312,6 +312,7 @@ static void cb_gelf_flush(struct flb_event_chunk *event_chunk, off = log_decoder.offset; size = off - prev_off; prev_off = off; + s = NULL; map = *log_event.body;