From 65d41d48a4e4e795d64dd7842a44d693b741bf31 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 29 Jan 2010 05:28:44 -0500 Subject: 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 Signed-off-by: Junio C Hamano --- commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'commit.c') 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--; -- cgit v1.2.1