From 53dc9a5aa677a578cef9c4272a436ca0b3d838ea Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Fri, 16 Feb 2024 04:03:40 +0000 Subject: [PATCH] Bug 5344: mgr:config segfaults without logformat (#1680) Since 2011 commit 38e16f9, Log::LogConfig::dumpFormats() dereferenced a nil `logformats` pointer while reporting a non-existent logformat configuration (e.g., squid.conf.default): `logformats->dump(e, name)`. In most environments, that code "worked" because the corresponding Format::Format::dump() method happens to do nothing if "this" is nil. However, in some environments, Squid segfaulted. --- src/log/Config.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/log/Config.h b/src/log/Config.h index 06c6b8242a..ce3f395688 100644 --- a/src/log/Config.h +++ b/src/log/Config.h @@ -36,7 +36,8 @@ public: void parseFormats(); void dumpFormats(StoreEntry *e, const char *name) { - logformats->dump(e, name); + if (logformats) + logformats->dump(e, name); } /// File path to logging daemon executable -- 2.47.2