From 0b0d6973bad930369d4483c96da233aeb24ff4ee Mon Sep 17 00:00:00 2001 From: Konstantina Chremmou Date: Sat, 12 Dec 2020 01:26:28 +0000 Subject: [PATCH] CA-348139: Don't exclude zero bytes from the checksum calculation during manifest verification. Signed-off-by: Konstantina Chremmou --- XenCenterLib/StreamUtilities.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/XenCenterLib/StreamUtilities.cs b/XenCenterLib/StreamUtilities.cs index 71268585c..6bea05265 100644 --- a/XenCenterLib/StreamUtilities.cs +++ b/XenCenterLib/StreamUtilities.cs @@ -84,13 +84,10 @@ namespace XenCenterLib if (bytesRead <= 0) 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;