mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 08:14:15 +00:00
check if RouterInfo has been decompressed completely
This commit is contained in:
parent
6885761f87
commit
ed874fe3ea
@ -556,8 +556,13 @@ namespace data
|
|||||||
}
|
}
|
||||||
uint8_t uncompressed[2048];
|
uint8_t uncompressed[2048];
|
||||||
size_t uncompressedSize = m_Inflator.Inflate (buf + offset, size, uncompressed, 2048);
|
size_t uncompressedSize = m_Inflator.Inflate (buf + offset, size, uncompressed, 2048);
|
||||||
if (uncompressedSize)
|
if (uncompressedSize && uncompressedSize < 2048)
|
||||||
updated = AddRouterInfo (ident, uncompressed, uncompressedSize);
|
updated = AddRouterInfo (ident, uncompressed, uncompressedSize);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, "NetDb: decompression failed ", uncompressedSize);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (replyToken && context.IsFloodfill () && updated)
|
if (replyToken && context.IsFloodfill () && updated)
|
||||||
|
@ -125,7 +125,8 @@ namespace data
|
|||||||
m_IsUnreachable = true;
|
m_IsUnreachable = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::stringstream str (std::string ((char *)m_Buffer + identityLen, m_BufferLen - identityLen));
|
std::stringstream str;
|
||||||
|
str.write ((const char *)m_Buffer + identityLen, m_BufferLen - identityLen);
|
||||||
ReadFromStream (str);
|
ReadFromStream (str);
|
||||||
if (!str)
|
if (!str)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user