]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix a possible integer overflow in Ftp::Gateway (#1647)
authorŠtěpán Brož <32738079+brozs@users.noreply.github.com>
Tue, 30 Jan 2024 21:35:37 +0000 (21:35 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 30 Jan 2024 21:35:49 +0000 (21:35 +0000)
A static analysis tool has discovered that const int csize,
might have overflowed before being passed to writeReplyBody().

src/clients/FtpGateway.cc

index 7fb43df3ea9b4b8b26627690c38c94e8ed6f3edb..fc26c9d383951c0b6eb9321c9d5f15667e71c3eb 100644 (file)
@@ -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);