Commit 90e520b4 authored by Felix Hädicke's avatar Felix Hädicke Committed by Alexandre Julliard

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=47918Signed-off-by: 's avatarFelix Hädicke <felixhaedicke@web.de> Signed-off-by: 's avatarPiotr Caban <piotr@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 8d6183c8
...@@ -52,13 +52,13 @@ static int FUNC_NAME(puts_clbk_str)(void *ctx, int len, const APICHAR *str) ...@@ -52,13 +52,13 @@ static int FUNC_NAME(puts_clbk_str)(void *ctx, int len, const APICHAR *str)
return len; return len;
if(out->len < 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->buf += out->len;
out->len = 0; out->len = 0;
return -1; return -1;
} }
memcpy(out->buf, str, len*sizeof(APICHAR)); memmove(out->buf, str, len*sizeof(APICHAR));
out->buf += len; out->buf += len;
out->len -= len; out->len -= len;
return len; return len;
......
...@@ -781,13 +781,13 @@ static int puts_clbk_str_c99_a(void *ctx, int len, const char *str) ...@@ -781,13 +781,13 @@ static int puts_clbk_str_c99_a(void *ctx, int len, const char *str)
return len; return len;
if(out->len < len) { if(out->len < len) {
memcpy(out->buf, str, out->len); memmove(out->buf, str, out->len);
out->buf += out->len; out->buf += out->len;
out->len = 0; out->len = 0;
return len; return len;
} }
memcpy(out->buf, str, len); memmove(out->buf, str, len);
out->buf += len; out->buf += len;
out->len -= len; out->len -= len;
return len; return len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment