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>
This commit is contained in:

committed by
Junio C Hamano

parent
cd2b8ae983
commit
7732118438
@ -533,7 +533,7 @@ static int ident_to_git(const char *path, const char *src, size_t len,
|
|||||||
dollar = memchr(src, '$', len);
|
dollar = memchr(src, '$', len);
|
||||||
if (!dollar)
|
if (!dollar)
|
||||||
break;
|
break;
|
||||||
memcpy(dst, src, dollar + 1 - src);
|
memmove(dst, src, dollar + 1 - src);
|
||||||
dst += dollar + 1 - src;
|
dst += dollar + 1 - src;
|
||||||
len -= dollar + 1 - src;
|
len -= dollar + 1 - src;
|
||||||
src = dollar + 1;
|
src = dollar + 1;
|
||||||
@ -553,7 +553,7 @@ static int ident_to_git(const char *path, const char *src, size_t len,
|
|||||||
src = dollar + 1;
|
src = dollar + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memcpy(dst, src, len);
|
memmove(dst, src, len);
|
||||||
strbuf_setlen(buf, dst + len - buf->buf);
|
strbuf_setlen(buf, dst + len - buf->buf);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user