CA-348139: Don't exclude zero bytes from the checksum calculation during manifest verification.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2020-12-12 01:26:28 +00:00
parent 3f5b11048f
commit 0b0d6973ba

View File

@ -84,13 +84,10 @@ namespace XenCenterLib
if (bytesRead <= 0) if (bytesRead <= 0)
break; break;
if (buffer.Any(b => b != 0x0)) if (offset + bytesRead < limit)
{ {
if (offset + bytesRead < limit) // This is not the last block. Compute the partial hash.
{ hashAlgorithm.TransformBlock(buffer, 0, bytesRead, buffer, 0);
// This is not the last block. Compute the partial hash.
hashAlgorithm.TransformBlock(buffer, 0, bytesRead, buffer, 0);
}
} }
offset += bytesRead; offset += bytesRead;