summaryrefslogtreecommitdiff
path: root/builtin/pack-objects.c
diff options
context:
space:
mode:
authorLibravatar Nguyễn Thái Ngọc Duy <pclouds@gmail.com>2011-10-24 17:36:09 +1100
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-10-27 11:08:26 -0700
commit0de1633783685e9fb1943551217cdda7edbd245b (patch)
tree581476c5e6b352769a391071595e625d7443db24 /builtin/pack-objects.c
parentMerge branch 'maint' (diff)
downloadtgif-0de1633783685e9fb1943551217cdda7edbd245b.tar.xz
tree-walk.c: do not leak internal structure in tree_entry_len()
tree_entry_len() does not simply take two random arguments and return a tree length. The two pointers must point to a tree item structure, or struct name_entry. Passing random pointers will return incorrect value. Force callers to pass struct name_entry instead of two pointers (with hope that they don't manually construct struct name_entry themselves) Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/pack-objects.c')
-rw-r--r--builtin/pack-objects.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index ba3705d1de..b4f7855550 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -979,7 +979,7 @@ static void add_pbase_object(struct tree_desc *tree,
while (tree_entry(tree,&entry)) {
if (S_ISGITLINK(entry.mode))
continue;
- cmp = tree_entry_len(entry.path, entry.sha1) != cmplen ? 1 :
+ cmp = tree_entry_len(&entry) != cmplen ? 1 :
memcmp(name, entry.path, cmplen);
if (cmp > 0)
continue;