mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
check for chunk size
This commit is contained in:
parent
20341a381f
commit
bc5ff37e37
8
util.cpp
8
util.cpp
|
@ -106,11 +106,15 @@ namespace http
|
|||
while (!response.eof ())
|
||||
{
|
||||
std::string hexLen;
|
||||
int len;
|
||||
size_t len;
|
||||
std::getline (response, hexLen);
|
||||
std::istringstream iss (hexLen);
|
||||
iss >> std::hex >> len;
|
||||
if (!len) break;
|
||||
if (!len || len > 10000000L) // 10M
|
||||
{
|
||||
LogPrint (eLogError, "Unexpected chunk length ", len);
|
||||
break;
|
||||
}
|
||||
char * buf = new char[len];
|
||||
response.read (buf, len);
|
||||
merged.write (buf, len);
|
||||
|
|
Loading…
Reference in a new issue