diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-07-31 19:39:12 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-07-31 19:39:12 (GMT) |
commit | 355ce624c0d79439fafb96eadcbc19380e8a4e9f (patch) | |
tree | 5cc06d0f9104d4831c8d3a4144c38adaed795443 /generic | |
parent | 61fa73a80ffe7bd7131dc59cacd7b8dcab57a3f7 (diff) | |
download | tcl-355ce624c0d79439fafb96eadcbc19380e8a4e9f.zip tcl-355ce624c0d79439fafb96eadcbc19380e8a4e9f.tar.gz tcl-355ce624c0d79439fafb96eadcbc19380e8a4e9f.tar.bz2 |
(cherry-pick from core-8-branch): Replace memcpy() calls with memmove() to avoid undefined behavior when source and destination overlap
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclUtf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 34fcdb5..7d3db57 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -857,7 +857,7 @@ Tcl_UtfToUpper( */ if (bytes < UtfCount(upChar)) { - memcpy(dst, src, (size_t) bytes); + memmove(dst, src, (size_t) bytes); dst += bytes; } else { dst += Tcl_UniCharToUtf(upChar, dst); @@ -910,7 +910,7 @@ Tcl_UtfToLower( */ if (bytes < UtfCount(lowChar)) { - memcpy(dst, src, (size_t) bytes); + memmove(dst, src, (size_t) bytes); dst += bytes; } else { dst += Tcl_UniCharToUtf(lowChar, dst); @@ -960,7 +960,7 @@ Tcl_UtfToTitle( titleChar = Tcl_UniCharToTitle(ch); if (bytes < UtfCount(titleChar)) { - memcpy(dst, src, (size_t) bytes); + memmove(dst, src, (size_t) bytes); dst += bytes; } else { dst += Tcl_UniCharToUtf(titleChar, dst); @@ -976,7 +976,7 @@ Tcl_UtfToTitle( } if (bytes < UtfCount(lowChar)) { - memcpy(dst, src, (size_t) bytes); + memmove(dst, src, (size_t) bytes); dst += bytes; } else { dst += Tcl_UniCharToUtf(lowChar, dst); |