]> git.ipfire.org Git - thirdparty/squid.git/commit
Limit Server::inBuf growth (#1898)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Mon, 9 Sep 2024 16:41:50 +0000 (16:41 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Mon, 9 Sep 2024 20:27:23 +0000 (20:27 +0000)
commit5f31e83aa7d399045171dafd10f6934cd1eb5d5c
tree6e6e1b58717d9e0f36d9152b3d1182d9fabe142b
parent5370d36199e577b6aa424658260aab08e32d9015
Limit Server::inBuf growth (#1898)

After a ReadNow() call, the buffer length must not exceed accumulation
limits (e.g., client_request_buffer_max_size). SBuf::reserve() alone
cannot reliably enforce those limits because it does not decrease SBuf
space; various SBuf manipulations may lead to excessive SBuf space. When
filled by ReadNow(), that space exceeds the limit.

This change uses documented CommIoCbParams::size trick to limit how much
Comm::ReadNow() may read, obeying SQUID_TCP_SO_RCVBUF (server-to-Squid)
and client_request_buffer_max_size (client-to-Squid) accumulation limit.
src/adaptation/icap/Xaction.cc
src/servers/Server.cc