From 7183c09d11ac4b98f1cc78f29dcbd85df5533001 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 20 Apr 2009 19:44:53 +0200 Subject: [PATCH] Fix off-by-one in read_tree_recursive Found by valgrind. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- tree.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tree.c b/tree.c index 0d703a0c4..5ab90af25 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; -- 2.30.2