fix: Skip the padding field when calculating header checksums

This commit is contained in:
apio 2023-01-19 22:32:01 +01:00
parent 240a4f2f1a
commit d8faf424ad
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -203,7 +203,7 @@ uint32_t minitar_checksum_header(const struct tar_header* hdr)
const uint8_t* ptr = (const uint8_t*)hdr;
// Sum up all bytes in the header, as unsigned bytes...
while (ptr < (const uint8_t*)hdr + sizeof *hdr)
while (ptr < (const uint8_t*)hdr + (sizeof *hdr - sizeof hdr->padding))
{
sum += *ptr;
ptr++;