0
0
mirror of https://github.com/monero-project/kovri synced 2025-10-06 00:32:51 +02:00

RouterInfo: don't throw on invalid RI size

Sanely, we would want to throw here but doing so will stop the router
instead of allowing the RI to become updated.

Referencing #917
This commit is contained in:
anonimal
2018-07-03 03:27:38 +00:00
parent 7129acd5f6
commit 237e1f5b53

View File

@@ -706,12 +706,14 @@ void RouterInfo::Verify()
{
try
{
// Get RI length without signature
std::size_t const len =
m_Buffer.size() - m_RouterIdentity.GetSignatureLen();
if (len < Size::MinUnsignedBuffer)
throw std::length_error("RouterInfo: invalid RouterInfo size");
// Confirm if valid and usable
const std::uint8_t* buf = m_Buffer.data();
if (!m_RouterIdentity.Verify(buf, len, &buf[len]))
if (len < Size::MinUnsignedBuffer
|| !m_RouterIdentity.Verify(buf, len, &buf[len]))
m_IsUnreachable = true;
}
catch (...)