From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Date: Mon, 21 Aug 2006 20:22:25 +0000 (+0200)
Subject: git-mv: fix off-by-one error
X-Git-Tag: v1.4.2.1~2
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6e17886d376ee8480cc9a8b9bc5046f2d721565f;p=git

git-mv: fix off-by-one error

Embarassing.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
---

diff --git a/builtin-mv.c b/builtin-mv.c
index b2ecc26f23..e3bc7a86bb 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -26,7 +26,7 @@ static const char **copy_pathspec(const char *prefix, const char **pathspec,
 		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) {