From: Štěpán Brož <32738079+brozs@users.noreply.github.com> Date: Tue, 30 Jan 2024 21:35:37 +0000 (+0000) Subject: Fix a possible integer overflow in Ftp::Gateway (#1647) X-Git-Tag: SQUID_6_7~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f5a74f2cd924997c27ade0341dcb7e78fcca9fb4;p=thirdparty%2Fsquid.git Fix a possible integer overflow in Ftp::Gateway (#1647) A static analysis tool has discovered that const int csize, might have overflowed before being passed to writeReplyBody(). --- diff --git a/src/clients/FtpGateway.cc b/src/clients/FtpGateway.cc index 1a51aa6307..22abc0d84b 100644 --- a/src/clients/FtpGateway.cc +++ b/src/clients/FtpGateway.cc @@ -1000,7 +1000,7 @@ Ftp::Gateway::processReplyBody() parseListing(); maybeReadVirginBody(); return; - } else if (const int csize = data.readBuf->contentSize()) { + } else if (const auto csize = data.readBuf->contentSize()) { writeReplyBody(data.readBuf->content(), csize); debugs(9, 5, "consuming " << csize << " bytes of readBuf"); data.readBuf->consume(csize);