From d8faf424ad64af0d42b44484c7baf57d2f1e3abd Mon Sep 17 00:00:00 2001 From: apio Date: Thu, 19 Jan 2023 22:32:01 +0100 Subject: [PATCH] fix: Skip the padding field when calculating header checksums --- src/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.c b/src/util.c index b771d08..e0e455a 100644 --- a/src/util.c +++ b/src/util.c @@ -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++;