mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
check max RouterInfo size
This commit is contained in:
parent
f20391d460
commit
a723405fb0
2 changed files with 17 additions and 10 deletions
|
@ -2937,13 +2937,15 @@ namespace transport
|
|||
i2p::data::GzipInflator inflator;
|
||||
uint8_t uncompressed[i2p::data::MAX_RI_BUFFER_SIZE];
|
||||
size_t uncompressedSize = inflator.Inflate (buf + 2, size - 2, uncompressed, i2p::data::MAX_RI_BUFFER_SIZE);
|
||||
if (uncompressedSize && uncompressedSize < i2p::data::MAX_RI_BUFFER_SIZE)
|
||||
if (uncompressedSize && uncompressedSize <= i2p::data::MAX_RI_BUFFER_SIZE)
|
||||
ri = std::make_shared<i2p::data::RouterInfo>(uncompressed, uncompressedSize);
|
||||
else
|
||||
LogPrint (eLogInfo, "SSU2: RouterInfo decompression failed ", uncompressedSize);
|
||||
}
|
||||
else
|
||||
else if (size <= i2p::data::MAX_RI_BUFFER_SIZE + 2)
|
||||
ri = std::make_shared<i2p::data::RouterInfo>(buf + 2, size - 2);
|
||||
else
|
||||
LogPrint (eLogInfo, "SSU2: RouterInfo is too long ", size);
|
||||
return ri;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue