1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-29 03:56:10 +02:00

tree-walk: replace hard-coded constants with the_hash_algo

Remove the hard-coded 20-based values and replace them with uses of
the_hash_algo.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
brian m. carlson 2018-07-16 01:27:54 +00:00 committed by Junio C Hamano
parent 509f6f62a4
commit 83e4b7571c

View File

@ -26,8 +26,9 @@ static int decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned l
{
const char *path;
unsigned int mode, len;
const unsigned hashsz = the_hash_algo->rawsz;
if (size < 23 || buf[size - 21]) {
if (size < hashsz + 3 || buf[size - (hashsz + 1)]) {
strbuf_addstr(err, _("too-short tree object"));
return -1;
}