summaryrefslogtreecommitdiff
path: root/tree.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2011-10-24 17:36:09 +1100
committerJunio C Hamano <gitster@pobox.com>2011-10-27 11:08:26 -0700
commit0de1633783685e9fb1943551217cdda7edbd245b (patch)
tree581476c5e6b352769a391071595e625d7443db24 /tree.c
parent997a1946a55cafb992c4ba8e5e0795aa73f5a4a9 (diff)
downloadgit-0de1633783685e9fb1943551217cdda7edbd245b.tar.gz
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 'tree.c')
-rw-r--r--tree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tree.c b/tree.c
index 698ecf7af1..e62219803b 100644
--- a/tree.c
+++ b/tree.c
@@ -99,7 +99,7 @@ static int read_tree_1(struct tree *tree, struct strbuf *base,
else
continue;
- len = tree_entry_len(entry.path, entry.sha1);
+ len = tree_entry_len(&entry);
strbuf_add(base, entry.path, len);
strbuf_addch(base, '/');
retval = read_tree_1(lookup_tree(sha1),