Skip to content

Commit

Permalink
Merge branch 'jc/ustar-checksum-is-unsigned'
Browse files Browse the repository at this point in the history
"git archive" incorrectly computed the header checksum; the symptom
was observed only when using pathnames with hi-bit set.

* jc/ustar-checksum-is-unsigned:
  archive: ustar header checksum is computed unsigned
  • Loading branch information
gitster committed Jun 25, 2012
2 parents d692d34 + a5a46eb commit dd39379
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions archive-tar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit dd39379

Please sign in to comment.