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_7_0_1~227 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c8f5d7dc677ff991802dcb6cfe458e5c5e02168f;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 7fb43df3ea..fc26c9d383 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);