]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix memory leak when parsing deprecated %rG logformat code (#2187)
authorJoshua Rogers <MegaManSec@users.noreply.github.com>
Mon, 8 Sep 2025 05:06:43 +0000 (05:06 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Mon, 8 Sep 2025 05:15:42 +0000 (05:15 +0000)
Also terminate the tables for ProxyProtocol and TableTransport %codes.

src/format/Token.cc

index 0b569c2430573755eb83a2b3fcfc0c198f450376..e044d421e7a3dfad265d31a4368105ae84fa9869 100644 (file)
@@ -183,10 +183,12 @@ static TokenTableEntry TokenTableMisc[] = {
 
 static TokenTableEntry TokenTableProxyProtocol[] = {
     TokenTableEntry(">h", LFT_PROXY_PROTOCOL_RECEIVED_HEADER),
+    TokenTableEntry(nullptr, LFT_NONE)           /* this must be last */
 };
 
 static TokenTableEntry TokenTableTransport[] = {
     TokenTableEntry(">connection_id", LFT_TRANSPORT_CLIENT_CONNECTION_ID),
+    TokenTableEntry(nullptr, LFT_NONE)           /* this must be last */
 };
 
 #if USE_ADAPTATION
@@ -724,7 +726,8 @@ Format::Token::parse(const char *def, Quoting *quoting)
     case LFT_REQUEST_URLGROUP_OLD_2X:
         debugs(46, DBG_PARSE_NOTE(DBG_IMPORTANT), "WARNING: The \"rG\" formatting code is deprecated. Use \"note{urlgroup}\" instead.");
         type = LFT_NOTE;
-        data.header.header = xstrdup("urlgroup");
+        data.string = xstrdup("urlgroup");
+        data.header.header = data.string;
         break;
 
     default: