From f43071fe697a96c70661c0f43ca78345e5e1d186 Mon Sep 17 00:00:00 2001 From: Szilard Parrag Date: Tue, 13 Aug 2024 11:16:42 +0200 Subject: [PATCH] fix(lib): check/sanitize generator_args value before using it This avoids crashing if `NULL` (==empty string) was passed as value. For details see https://github.com/axoflow/axosyslog/pull/254#issuecomment-2414519383 --- lib/cfg-block-generator.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/cfg-block-generator.c b/lib/cfg-block-generator.c index 9374c58e8d..00811f2784 100644 --- a/lib/cfg-block-generator.c +++ b/lib/cfg-block-generator.c @@ -39,6 +39,7 @@ _report_generator_args(gpointer key, gpointer value, gpointer user_data) { GString *result = (GString *) user_data; g_string_append_printf(result, "## %s=", (gchar *) key); + value = value ? : ""; for (const gchar *c = (const gchar *) value; *c; c++) { if (*c == '\n' && *(c + 1))