{"thread":{"id":"43159","subject":"Use memmove instead of memcpy for overlapping areas","startedAt":"2006-10-30T21:26:15Z","lastAt":"2006-10-31T01:37:22Z","messageCount":2,"participants":["Edgar Toernig","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"293948","messageId":"20061030222615.1e38908b.froese@gmx.de","threadId":"43159","inReplyTo":null,"subject":"Use memmove instead of memcpy for overlapping areas","fromName":"Edgar Toernig","fromEmail":"froese@gmx.de","sentAt":"2006-10-30T21:26:15Z","receivedAt":"2006-10-30T21:26:15Z","isPatch":false,"sender":{"key":"froese@gmx.de","avatar":null},"body":"There may be more - this is just the result of a quick eye-grep\nfor memcpy(x, x+i).\n\ndiff --git a/imap-send.c b/imap-send.c\nindex 16804ab..88d635f 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -272,7 +272,7 @@ buffer_gets( buffer_t * b, char **s )\n \t\t\t\tn = b->bytes - start;\n \n \t\t\t\tif (n)\n-\t\t\t\t\tmemcpy( b->buf, b->buf + start, n );\n+\t\t\t\t\tmemmove( b->buf, b->buf + start, n );\n \t\t\t\tb->offset -= start;\n \t\t\t\tb->bytes = n;\n \t\t\t\tstart = 0;\ndiff --git a/index-pack.c b/index-pack.c\nindex e33f605..a275982 100644\n--- a/index-pack.c\n+++ b/index-pack.c\n@@ -61,7 +61,7 @@ static void * fill(int min)\n \t\tdie(\"cannot fill %d bytes\", min);\n \tif (input_offset) {\n \t\tSHA1_Update(&input_ctx, input_buffer, input_offset);\n-\t\tmemcpy(input_buffer, input_buffer + input_offset, input_len);\n+\t\tmemmove(input_buffer, input_buffer + input_offset, input_len);\n \t\tinput_offset = 0;\n \t}\n \tdo {\n\n"},{"id":"294012","messageId":"7vpsc9s1t9.fsf@assigned-by-dhcp.cox.net","threadId":"43159","inReplyTo":"20061030222615.1e38908b.froese@gmx.de","subject":"Re: Use memmove instead of memcpy for overlapping areas","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-31T01:37:22Z","receivedAt":"2006-10-31T01:37:22Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Edgar Toernig <froese@gmx.de> writes:\n\n> There may be more - this is just the result of a quick eye-grep\n> for memcpy(x, x+i).\n\nThanks.  Sign-off?\n\nAmong many false hit, \n\n$ git grep 'memcpy.*( *\\(.*\\),.*\\1.*+'\n\ngives this one:\n\nbuiltin-unpack-objects.c:               memcpy(buffer, buffer + offset, len);\n"}]}