1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-02-02 02:44:15 +00:00

don't save RouterInfo buffer if invalid

This commit is contained in:
orignal 2023-02-12 09:21:59 -05:00
parent d79bdc9f66
commit 88f19f551d

View File

@ -99,13 +99,13 @@ namespace data
m_Caps = 0; m_Caps = 0;
// don't clean up m_Addresses, it will be replaced in ReadFromStream // don't clean up m_Addresses, it will be replaced in ReadFromStream
ClearProperties (); ClearProperties ();
// copy buffer
UpdateBuffer (buf, len);
// skip identity // skip identity
size_t identityLen = m_RouterIdentity->GetFullLen (); size_t identityLen = m_RouterIdentity->GetFullLen ();
// read new RI // read new RI
std::stringstream str (std::string ((char *)m_Buffer->data () + identityLen, m_BufferLen - identityLen)); std::stringstream str (std::string ((char *)buf + identityLen, len - identityLen));
ReadFromStream (str); ReadFromStream (str);
if (!m_IsUnreachable)
UpdateBuffer (buf, len); // save buffer
// don't delete buffer until saved to the file // don't delete buffer until saved to the file
} }
else else