diff --git a/NetDb.cpp b/NetDb.cpp index 1d6287ad..458e2a99 100644 --- a/NetDb.cpp +++ b/NetDb.cpp @@ -179,8 +179,8 @@ namespace data void NetDb::AddRouterInfo (const uint8_t * buf, int len) { IdentityEx identity; - identity.FromBuffer (buf, len); - AddRouterInfo (identity.GetIdentHash (), buf, len); + if (identity.FromBuffer (buf, len)) + AddRouterInfo (identity.GetIdentHash (), buf, len); } void NetDb::AddRouterInfo (const IdentHash& ident, const uint8_t * buf, int len) diff --git a/Reseed.cpp b/Reseed.cpp index 03df41fa..057db441 100644 --- a/Reseed.cpp +++ b/Reseed.cpp @@ -240,7 +240,12 @@ namespace data localFileName[fileNameLength] = 0; s.seekg (extraFieldLength, std::ios::cur); LogPrint (eLogDebug, "Proccessing file ", localFileName, " ", compressedSize, " bytes"); - + if (!compressedSize) + { + LogPrint (eLogWarning, "Unexpected size 0. Skipped"); + continue; + } + uint8_t * compressed = new uint8_t[compressedSize]; s.read ((char *)compressed, compressedSize); if (compressionMethod) // we assume Deflate