Browse Source

check RI signture before processing

pull/633/head
orignal 8 years ago
parent
commit
f9a5f4955c
  1. 20
      RouterInfo.cpp

20
RouterInfo.cpp

@ -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)

Loading…
Cancel
Save