From: Alex Rousskov Date: Fri, 16 Feb 2024 04:03:40 +0000 (+0000) Subject: Bug 5344: mgr:config segfaults without logformat (#1680) X-Git-Tag: SQUID_6_8~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=53dc9a5aa677a578cef9c4272a436ca0b3d838ea;p=thirdparty%2Fsquid.git 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. --- 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