]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 5344: mgr:config segfaults without logformat (#1680)
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 16 Feb 2024 04:03:40 +0000 (04:03 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Fri, 16 Feb 2024 07:34:32 +0000 (07:34 +0000)
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

index 06c6b8242aa02321fe0ce0719cc3b8652a451849..ce3f395688ac22a96c3d1e90095698ceeda1152c 100644 (file)
@@ -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