aboutsummaryrefslogtreecommitdiffstats
path: root/tree-walk.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-08-02 15:30:39 -0700
committerJunio C Hamano <gitster@pobox.com>2018-08-02 15:30:39 -0700
commit37aac3e408fa2348983e964f8bda2de581f2c44e (patch)
tree1a59edd1eb2ece6e597342460b5b199ef2c5624b /tree-walk.c
parentbba1a5559cd0015165563fd01d23bbd5e52bea72 (diff)
parent580f0980e11b9dcfdaf0f8af12b8cef7c702a7e1 (diff)
downloadgit-37aac3e408fa2348983e964f8bda2de581f2c44e.tar.gz
Merge branch 'bc/object-id'
Conversion from uchar[40] to struct object_id continues. * bc/object-id: pretty: switch hard-coded constants to the_hash_algo sha1-file: convert constants to uses of the_hash_algo log-tree: switch GIT_SHA1_HEXSZ to the_hash_algo->hexsz diff: switch GIT_SHA1_HEXSZ to use the_hash_algo builtin/merge-recursive: make hash independent builtin/merge: switch to use the_hash_algo builtin/fmt-merge-msg: make hash independent builtin/update-index: simplify parsing of cacheinfo builtin/update-index: convert to using the_hash_algo refs/files-backend: use the_hash_algo for writing refs sha1-name: use the_hash_algo when parsing object names strbuf: allocate space with GIT_MAX_HEXSZ commit: express tree entry constants in terms of the_hash_algo hex: switch to using the_hash_algo tree-walk: replace hard-coded constants with the_hash_algo cache: update object ID functions for the_hash_algo
Diffstat (limited to 'tree-walk.c')
-rw-r--r--tree-walk.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tree-walk.c b/tree-walk.c
index ecd6e53b85..77b37f36fa 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -27,8 +27,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;
}