[PATCH] Fix off-by-one in read_tree_recursive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Found by valgrind.

Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
---
 tree.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]