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

[PATCH] git-mv: fix off-by-one error

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 21, 2006, 20:22 UTC
Message-ID
<Pine.LNX.4.63.0608212221500.28360@wbgn013.biozentrum.uni-wuerzburg.de>
Embarassing.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
	This bug made t7001-mv.sh fail with the patch in
	http://article.gmane.org/gmane.comp.version-control.git/25647
	when XMALLOC_POISON was set, which was probably the reason it
	was not yet applied...
 builtin-mv.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin-mv.c b/builtin-mv.c
index 6e7062b..ff882be 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -26,7 +26,7 @@ static const char **copy_pathspec(const 
 		if (length > 0 && result[i][length - 1] == '/') {
 			char *without_slash = xmalloc(length);
 			memcpy(without_slash, result[i], length - 1);
-			without_slash[length] = '\0';
+			without_slash[length - 1] = '\0';
 			result[i] = without_slash;
 		}
 		if (base_name) {
-- 
1.4.2.gc69d
Message 1 of 1 in “git-mv: fix off-by-one error”
  1. git-mv: fix off-by-one errorJohannes Schindelin, Aug 21, 2006

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.