git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Fix off-by-one in read_tree_recursive

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Apr 20, 2009, 17:44 UTC
Message-ID
<f62793069ecb99138c435edf37533906c4aae301.1240249482u.git.johannes.schindelin@gmx.de>
In-Reply-To
<cover.1240249482u.git.johannes.schindelin@gmx.de>
Found by valgrind.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 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
Next: Andy Lester
Message 1 of 5 in “Fix off-by-one in read_tree_recursive”
  1. Fix off-by-one in read_tree_recursiveJohannes Schindelin, Apr 20, 2009
  2. valgrindAndy Lester, Apr 20, 2009
  3. Johannes SchindelinApr 20, 2009
  4. Andy LesterApr 20, 2009
  5. Junio C HamanoApr 21, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.