mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-10-05 23:08:01 +00:00
check piece's next hash string length
This commit is contained in:
@@ -453,7 +453,7 @@ namespace torrents
|
||||
{
|
||||
auto [hashes, len] = ExtractByteString (buf);
|
||||
size_t totalLen = 0;
|
||||
while (!hashes.empty () && totalLen < m_Length)
|
||||
while (hashes.length () >= SHA_DIGEST_LENGTH && totalLen < m_Length)
|
||||
{
|
||||
auto l = (totalLen + m_PieceLength <= m_Length) ? m_PieceLength : m_Length - totalLen;
|
||||
m_Pieces.emplace_back (l, (const uint8_t *)hashes.substr (0, SHA_DIGEST_LENGTH).data ());
|
||||
|
||||
Reference in New Issue
Block a user