aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-04-03 13:39:06 -0700
committerJunio C Hamano <gitster@pobox.com>2014-04-03 13:39:06 -0700
commit3097b687bea8817b4b0afd84db8c4b1079cea92f (patch)
treec7095afe521727f96b7ae6965cc967fc55377473 /builtin
parenta3236f47392dd28d39f7156742db7cd4b1aca4c0 (diff)
parentfb8a4e8079ab8fc37e9cde32957c35637280ab8f (diff)
downloadgit-3097b687bea8817b4b0afd84db8c4b1079cea92f.tar.gz
git-3097b687bea8817b4b0afd84db8c4b1079cea92f.tar.xz
Merge branch 'jk/mv-submodules-fix' into maint
* jk/mv-submodules-fix: mv: prevent mismatched data when ignoring errors. builtin/mv: fix out of bounds write Conflicts: t/t7001-mv.sh
Diffstat (limited to 'builtin')
-rw-r--r--builtin/mv.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/builtin/mv.c b/builtin/mv.c
index 21c46d163..45e57f307 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -179,6 +179,9 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
modes = xrealloc(modes,
(argc + last - first)
* sizeof(enum update_mode));
+ submodule_gitfile = xrealloc(submodule_gitfile,
+ (argc + last - first)
+ * sizeof(char *));
}
dst = add_slash(dst);
@@ -192,6 +195,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
prefix_path(dst, dst_len,
path + length + 1);
modes[argc + j] = INDEX;
+ submodule_gitfile[argc + j] = NULL;
}
argc += last - first;
}
@@ -227,6 +231,11 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
memmove(destination + i,
destination + i + 1,
(argc - i) * sizeof(char *));
+ memmove(modes + i, modes + i + 1,
+ (argc - i) * sizeof(enum update_mode));
+ memmove(submodule_gitfile + i,
+ submodule_gitfile + i + 1,
+ (argc - i) * sizeof(char *));
i--;
}
} else