From 88f19f551d9c11330b5e0b96f52bcfdab6ccf195 Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 12 Feb 2023 09:21:59 -0500 Subject: [PATCH] don't save RouterInfo buffer if invalid --- libi2pd/RouterInfo.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libi2pd/RouterInfo.cpp b/libi2pd/RouterInfo.cpp index 32b01217..1bf1d42d 100644 --- a/libi2pd/RouterInfo.cpp +++ b/libi2pd/RouterInfo.cpp @@ -99,13 +99,13 @@ namespace data m_Caps = 0; // don't clean up m_Addresses, it will be replaced in ReadFromStream ClearProperties (); - // copy buffer - UpdateBuffer (buf, len); // skip identity size_t identityLen = m_RouterIdentity->GetFullLen (); // 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); + if (!m_IsUnreachable) + UpdateBuffer (buf, len); // save buffer // don't delete buffer until saved to the file } else