Skip to content

Commit 7732118

Browse files
trastgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cd2b8ae commit 7732118

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

convert.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ static int ident_to_git(const char *path, const char *src, size_t len,
533533
dollar = memchr(src, '$', len);
534534
if (!dollar)
535535
break;
536-
memcpy(dst, src, dollar + 1 - src);
536+
memmove(dst, src, dollar + 1 - src);
537537
dst += dollar + 1 - src;
538538
len -= dollar + 1 - src;
539539
src = dollar + 1;
@@ -553,7 +553,7 @@ static int ident_to_git(const char *path, const char *src, size_t len,
553553
src = dollar + 1;
554554
}
555555
}
556-
memcpy(dst, src, len);
556+
memmove(dst, src, len);
557557
strbuf_setlen(buf, dst + len - buf->buf);
558558
return 1;
559559
}

0 commit comments

Comments
 (0)