diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2011-10-24 17:36:09 +1100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-10-27 11:08:26 -0700 |
commit | 0de1633783685e9fb1943551217cdda7edbd245b (patch) | |
tree | 581476c5e6b352769a391071595e625d7443db24 /builtin/grep.c | |
parent | Merge branch 'maint' (diff) | |
download | tgif-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/grep.c')
-rw-r--r-- | builtin/grep.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/grep.c b/builtin/grep.c index 7d0779f6cf..2cd06126d2 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -547,7 +547,7 @@ static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec, int old_baselen = base->len; while (tree_entry(tree, &entry)) { - int te_len = tree_entry_len(entry.path, entry.sha1); + int te_len = tree_entry_len(&entry); if (match != 2) { match = tree_entry_interesting(&entry, base, tn_len, pathspec); |