1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-22 08:14:15 +00:00

check RI signture before processing

This commit is contained in:
orignal 2016-09-12 21:37:43 -04:00
parent 325b362727
commit f9a5f4955c

View File

@ -125,15 +125,6 @@ namespace data
m_IsUnreachable = true; m_IsUnreachable = true;
return; return;
} }
std::stringstream str;
str.write ((const char *)m_Buffer + identityLen, m_BufferLen - identityLen);
ReadFromStream (str);
if (!str)
{
LogPrint (eLogError, "RouterInfo: malformed message");
m_IsUnreachable = true;
return;
}
if (verifySignature) if (verifySignature)
{ {
// verify signature // verify signature
@ -142,9 +133,20 @@ namespace data
{ {
LogPrint (eLogError, "RouterInfo: signature verification failed"); LogPrint (eLogError, "RouterInfo: signature verification failed");
m_IsUnreachable = true; m_IsUnreachable = true;
return;
} }
m_RouterIdentity->DropVerifier (); m_RouterIdentity->DropVerifier ();
} }
// parse RI
std::stringstream str;
str.write ((const char *)m_Buffer + identityLen, m_BufferLen - identityLen);
ReadFromStream (str);
if (!str)
{
LogPrint (eLogError, "RouterInfo: malformed message");
m_IsUnreachable = true;
}
} }
void RouterInfo::ReadFromStream (std::istream& s) void RouterInfo::ReadFromStream (std::istream& s)