]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Ftp::Gateway may segfault in level-3 double-complete debugs() (#1923)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Mon, 28 Oct 2024 09:51:42 +0000 (09:51 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 29 Oct 2024 06:13:35 +0000 (06:13 +0000)
Ftp::Gateway::completeForwarding() must check data.conn pointer before
dereferencing it. Long-term, we should improve Comm::ConnectionPointer
printing to safely report Connection::id (where available). This minimal
fix just mimics existing Ftp::Relay::abortOnData() solution.

src/clients/FtpGateway.cc

index 675c08dfec292cc0d07a76f8a885bcccd12995c5..63a038925b492ad787f0ab82cfd3994ac34f9673 100644 (file)
@@ -2639,7 +2639,7 @@ Ftp::Gateway::completeForwarding()
 {
     if (fwd == nullptr || flags.completed_forwarding) {
         debugs(9, 3, "avoid double-complete on FD " <<
-               (ctrl.conn ? ctrl.conn->fd : -1) << ", Data FD " << data.conn->fd <<
+               (ctrl.conn ? ctrl.conn->fd : -1) << ", Data FD " << (data.conn ? data.conn->fd : -1) <<
                ", this " << this << ", fwd " << fwd);
         return;
     }