mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
allocate actual RouterInfo's buffer size
This commit is contained in:
parent
f784cfad46
commit
7b9033d678
3 changed files with 40 additions and 19 deletions
|
@ -698,14 +698,14 @@ namespace data
|
|||
LogPrint (eLogDebug, "NetDb: store request: RouterInfo");
|
||||
size_t size = bufbe16toh (buf + offset);
|
||||
offset += 2;
|
||||
if (size > 2048 || size > len - offset)
|
||||
if (size > MAX_RI_BUFFER_SIZE || size > len - offset)
|
||||
{
|
||||
LogPrint (eLogError, "NetDb: invalid RouterInfo length ", (int)size);
|
||||
return;
|
||||
}
|
||||
uint8_t uncompressed[2048];
|
||||
size_t uncompressedSize = m_Inflator.Inflate (buf + offset, size, uncompressed, 2048);
|
||||
if (uncompressedSize && uncompressedSize < 2048)
|
||||
uint8_t uncompressed[MAX_RI_BUFFER_SIZE];
|
||||
size_t uncompressedSize = m_Inflator.Inflate (buf + offset, size, uncompressed, MAX_RI_BUFFER_SIZE);
|
||||
if (uncompressedSize && uncompressedSize < MAX_RI_BUFFER_SIZE)
|
||||
updated = AddRouterInfo (ident, uncompressed, uncompressedSize);
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue