diff --git a/archive-tar.c b/archive-tar.c index dc91c6b50d..0ba3f25cf5 100644 --- a/archive-tar.c +++ b/archive-tar.c @@ -139,13 +139,13 @@ static void strbuf_append_ext_header(struct strbuf *sb, const char *keyword, static unsigned int ustar_header_chksum(const struct ustar_header *header) { - const char *p = (const char *)header; + const unsigned char *p = (const unsigned char *)header; unsigned int chksum = 0; - while (p < header->chksum) + while (p < (const unsigned char *)header->chksum) chksum += *p++; chksum += sizeof(header->chksum) * ' '; p += sizeof(header->chksum); - while (p < (const char *)header + sizeof(struct ustar_header)) + while (p < (const unsigned char *)header + sizeof(struct ustar_header)) chksum += *p++; return chksum; }