Code

git-mv: fix off-by-one error
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Mon, 21 Aug 2006 20:22:25 +0000 (22:22 +0200)
committerJunio C Hamano <junkio@cox.net>
Mon, 21 Aug 2006 21:15:45 +0000 (14:15 -0700)
Embarassing.

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

index b2ecc26f238f9f2a7297164145a19397c124b96f..e3bc7a86bb0732f5db760151088c73c87f88e637 100644 (file)
@@ -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) {