X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6636ef8ddf9eda0d0352c29d98cb141676a51a2d..532324df237338fafaddfc83d987b372f361c4b5:/src/common/stringimpl.cpp diff --git a/src/common/stringimpl.cpp b/src/common/stringimpl.cpp index ed9a83e476..498793722e 100644 --- a/src/common/stringimpl.cpp +++ b/src/common/stringimpl.cpp @@ -681,7 +681,11 @@ bool wxStringImpl::AssignCopy(size_t nSrcLen, // allocation failure handled by caller return false; } - memcpy(m_pchData, pszSrcData, nSrcLen*sizeof(wxStringCharType)); + + // use memmove() and not memcpy() here as we might be copying from our own + // buffer in case of assignment such as "s = s.c_str()" (see #11294) + memmove(m_pchData, pszSrcData, nSrcLen*sizeof(wxStringCharType)); + GetStringData()->nDataLength = nSrcLen; m_pchData[nSrcLen] = wxT('\0'); }