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 --- dlls/msvcrt/printf.h | 4 ++-- dlls/msvcrt/wcs.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/msvcrt/printf.h b/dlls/msvcrt/printf.h index a0d75401c4..346fb5ac5d 100644 --- a/dlls/msvcrt/printf.h +++ b/dlls/msvcrt/printf.h @@ -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; diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c index f84963ce2e..3e5bb512ff 100644 --- a/dlls/msvcrt/wcs.c +++ b/dlls/msvcrt/wcs.c @@ -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; -- 2.23.0.162.g0b9fbb3734