Use memmove in ident_to_git
convert_to_git sets src=dst->buf if any of the preceding conversions actually did any work. Thus in ident_to_git we have to use memmove instead of memcpy as far as src->dst copying is concerned. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Thomas Rast committed
Aug 29, 2011 at 22:06 UTC
7732118438764cfe49b8e0ad2c63e6dc97be45ed
1 file changed
+2
-2
convert.c
+2
-2
@@ -533,7 +533,7 @@ static int ident_to_git(const char *path, const char *src, size_t len,
533
dollar = memchr(src, '$', len);
534
if (!dollar)
535
break;
536
- memcpy(dst, src, dollar + 1 - src);
536
+ memmove(dst, src, dollar + 1 - src);
537
dst += dollar + 1 - src;
538
len -= dollar + 1 - src;
539
src = dollar + 1;
@@ -553,7 +553,7 @@ static int ident_to_git(const char *path, const char *src, size_t len,
553
src = dollar + 1;
554
}
555
}
556
- memcpy(dst, src, len);
556
+ memmove(dst, src, len);
557
strbuf_setlen(buf, dst + len - buf->buf);
558
return 1;
559
}