Code

Don't use memcpy when source and dest. buffers may overlap
authorJim Meyering <jim@meyering.net>
Mon, 11 Dec 2006 18:06:34 +0000 (19:06 +0100)
committerJunio C Hamano <junkio@cox.net>
Mon, 11 Dec 2006 22:04:43 +0000 (14:04 -0800)
commit554a2636f7c5125a83bb07194632445467d46c83
tree986dadaab34789ac35b71270d133af0dee9ea5ba
parentd44c92d6ab4ded7a1960bb0b4a1da0c2fc102b89
Don't use memcpy when source and dest. buffers may overlap

git-index-pack can call memcpy with overlapping source and destination
buffers.  The patch below makes it use memmove instead.

If you want to demonstrate a failure, add the following two lines

+               if (input_offset < input_len)
+                 abort ();

before the existing memcpy call (shown in the patch below),
and then run this:

  (cd t; sh ./t5500-fetch-pack.sh)

Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
index-pack.c