summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-07-11 19:45:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-07-11 19:45:07 (GMT)
commitcf04a660bb471dae76772f63f071768afb6d347c (patch)
tree8fbba8586712569ff630638725145bb09950e0f3
parente49bf52a1a6654f295718be61fc7a86cbee5eadf (diff)
parenta5a46eb90f530c731084a57783ca9fdbf1a52163 (diff)
downloadgit-cf04a660bb471dae76772f63f071768afb6d347c.zip
git-cf04a660bb471dae76772f63f071768afb6d347c.tar.gz
git-cf04a660bb471dae76772f63f071768afb6d347c.tar.bz2
Merge branch 'jc/ustar-checksum-is-unsigned' into maint
"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
-rw-r--r--archive-tar.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/archive-tar.c b/archive-tar.c
index dc91c6b..0ba3f25 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;
}