Merge branch 'jc/hash-object'
"hash-object --literally" introduced in v2.2 was not prepared to take a really long object type name. * jc/hash-object: write_sha1_file(): do not use a separate sha1[] array t1007: add hash-object --literally tests hash-object --literally: fix buffer overrun with extra-long object type git-hash-object.txt: document --literally option
This commit is contained in:
@ -22,10 +22,8 @@ static int hash_literally(unsigned char *sha1, int fd, const char *type, unsigne
|
||||
|
||||
if (strbuf_read(&buf, fd, 4096) < 0)
|
||||
ret = -1;
|
||||
else if (flags & HASH_WRITE_OBJECT)
|
||||
ret = write_sha1_file(buf.buf, buf.len, type, sha1);
|
||||
else
|
||||
ret = hash_sha1_file(buf.buf, buf.len, type, sha1);
|
||||
ret = hash_sha1_file_literally(buf.buf, buf.len, type, sha1, flags);
|
||||
strbuf_release(&buf);
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user