threads / patch / 5345

patchgit-mv: fix off-by-one error

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

## tl;dr

One message between Aug 21, 2006 and Aug 21, 2006. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Johannes Schindelin· Aug 21, 2006, 20:22 UTC · lore
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(-)
Show changes to builtin-mv.c +1 −1
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

← back to recent threads