From f5a74f2cd924997c27ade0341dcb7e78fcca9fb4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=A0t=C4=9Bp=C3=A1n=20Bro=C5=BE?= <32738079+brozs@users.noreply.github.com> Date: Tue, 30 Jan 2024 21:35:37 +0000 Subject: [PATCH] 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(). --- src/clients/FtpGateway.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.47.2