threads / patch / 18971

patchFix off-by-one in read_tree_recursive

Subject: [PATCH] Fix off-by-one in read_tree_recursive

## tl;dr

5 messages between Apr 20, 2009 and Apr 21, 2009. Diffs are folded; open one to read it.

replies: 4people: 3as markdown or json

Johannes Schindelin· Apr 20, 2009, 17:44 UTC · lore
Found by valgrind.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 tree.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Show changes to tree.c +1 −0
diff --git a/tree.c b/tree.c
index 0d703a0..5ab90af 100644
--- a/tree.c
+++ b/tree.c
@@ -62,6 +62,7 @@ static int match_tree_entry(const char *base, int baselen, const char *path, uns
 				continue;
 			/* pathspecs match only at the directory boundaries */
 			if (!matchlen ||
+			    baselen == matchlen ||
 			    base[matchlen] == '/' ||
 			    match[matchlen - 1] == '/')
 				return 1;
-- 
1.6.2.1.493.g67cf3
Andy Lester· Apr 20, 2009, 18:06 UTC · re: Johannes Schindelin · lore

valgrind

On Apr 20, 2009, at 12:44 PM, Johannes Schindelin wrote:
> Found by valgrind.

How are you running valgrind? Do you have a test suite for it? A make target?

xoa

-- Andy Lester => andy@petdance.com => www.theworkinggeek.com => AIM:petdance

Johannes Schindelin· Apr 20, 2009, 18:34 UTC · re: Andy Lester · lore

Re: valgrind

Hi,
On Mon, 20 Apr 2009, Andy Lester wrote:
Show 6 quoted lines
> On Apr 20, 2009, at 12:44 PM, Johannes Schindelin wrote:
> 
> >Found by valgrind.
> 
> How are you running valgrind?  Do you have a test suite for it?  A make 
> target?
Yes, it was merged into Git:
http://repo.or.cz/w/alt-git.git?a=commitdiff;h=8a61097cde387870921e822bdf90b4ffd3792845

Hth, Dscho

Andy Lester· Apr 20, 2009, 18:36 UTC · re: Johannes Schindelin · lore

Re: valgrind

On Apr 20, 2009, at 1:34 PM, Johannes Schindelin wrote:
> Yes, it was merged into Git:
>
> http://repo.or.cz/w/alt-git.git?a=commitdiff;h=8a61097cde387870921e822bdf90b4ffd3792845

Very cool. In my Copious Free Time, I'm trying to get a splint target built up.

xoxo, Andy

-- Andy Lester => andy@petdance.com => www.theworkinggeek.com => AIM:petdance

← back to recent threads