msvcrt: Use memmove() instead of memcpy() puts_clbk_str().
memcpy() must not be used here, because results are undefined if the memory areas overlap. This can cause problems, particularly if particular compiler optimisations are enabled. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47918 Signed-off-by: Felix Hädicke <felixhaedicke@web.de> Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8d6183c832
commit
90e520b418
|
@ -52,13 +52,13 @@ static int FUNC_NAME(puts_clbk_str)(void *ctx, int len, const APICHAR *str)
|
|||
return len;
|
||||
|
||||
if(out->len < len) {
|
||||
memcpy(out->buf, str, out->len*sizeof(APICHAR));
|
||||
memmove(out->buf, str, out->len*sizeof(APICHAR));
|
||||
out->buf += out->len;
|
||||
out->len = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(out->buf, str, len*sizeof(APICHAR));
|
||||
memmove(out->buf, str, len*sizeof(APICHAR));
|
||||
out->buf += len;
|
||||
out->len -= len;
|
||||
return len;
|
||||
|
|
|
@ -781,13 +781,13 @@ static int puts_clbk_str_c99_a(void *ctx, int len, const char *str)
|
|||
return len;
|
||||
|
||||
if(out->len < len) {
|
||||
memcpy(out->buf, str, out->len);
|
||||
memmove(out->buf, str, out->len);
|
||||
out->buf += out->len;
|
||||
out->len = 0;
|
||||
return len;
|
||||
}
|
||||
|
||||
memcpy(out->buf, str, len);
|
||||
memmove(out->buf, str, len);
|
||||
out->buf += len;
|
||||
out->len -= len;
|
||||
return len;
|
||||
|
|
Loading…
Reference in New Issue