Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2010-01-29 13:28:44 +0300
committerJunio C Hamano <gitster@pobox.com>2010-01-29 20:52:21 +0300
commit65d41d48a4e4e795d64dd7842a44d693b741bf31 (patch)
tree3da4b0052c10b5468c83b52dc990801d8cbdc9da /commit.c
parent35eabd1579726d594e84fc8328a5c87693dd065a (diff)
fix memcpy of overlapping area
Caught by valgrind in t5500, but it is pretty obvious from reading the code that this is shifting elements of an array to the left, which needs memmove. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/commit.c b/commit.c
index 6393e1b362..a51d2cd1be 100644
--- a/commit.c
+++ b/commit.c
@@ -225,7 +225,7 @@ int unregister_shallow(const unsigned char *sha1)
if (pos < 0)
return -1;
if (pos + 1 < commit_graft_nr)
- memcpy(commit_graft + pos, commit_graft + pos + 1,
+ memmove(commit_graft + pos, commit_graft + pos + 1,
sizeof(struct commit_graft *)
* (commit_graft_nr - pos - 1));
commit_graft_nr--;