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

1 messages from 2006-08-21 to 2006-08-21. Participants: Johannes Schindelin.
Thread: https://gitlist.dev/t/5345

## Johannes Schindelin, 2006-08-21 20:22

Subject: [PATCH] git-mv: fix off-by-one error
Message-ID: <Pine.LNX.4.63.0608212221500.28360@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0608212221500.28360%40wbgn013.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

```
