http response: check if result would fit into chunkLen

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I6e3b73461653d2ab3cedaa3f6ca7fbfd2a826edb
pull/2821/head
Miklos Vajna 2021-07-07 11:54:34 +02:00
parent 858aaab5a7
commit 57d3d0f391
2 changed files with 5 additions and 0 deletions

View File

@ -553,6 +553,11 @@ int64_t Response::readData(const char* p, int64_t len)
if (digit < 0)
break;
if (chunkLen >= (std::numeric_limits<int64_t>::max() - digit) / 16)
{
// Would not fit into chunkLen.
return len - available;
}
chunkLen = chunkLen * 16 + digit;
}