Index: src/libchcore/TString.cpp =================================================================== diff -u -r7ae0f5911d045f82328b6cfb88eccf67113708fa -rbc92f84c651802e7c804bc53d8898953275ac58a --- src/libchcore/TString.cpp (.../TString.cpp) (revision 7ae0f5911d045f82328b6cfb88eccf67113708fa) +++ src/libchcore/TString.cpp (.../TString.cpp) (revision bc92f84c651802e7c804bc53d8898953275ac58a) @@ -474,8 +474,10 @@ size_t stCountToDelete = std::min(stCurrentLength - stIndex, stCount); - wmemmove(m_pszStringData + stIndex, m_pszStringData + stIndex + stCountToDelete, stCurrentLength - stIndex); - m_pszStringData[stCurrentLength - stCountToDelete] = _T('\0'); + // should also copy the terminating null character + errno_t err = wmemmove_s(m_pszStringData + stIndex, stCurrentLength - stIndex + 1, m_pszStringData + stIndex + stCountToDelete, stCurrentLength - stIndex - stCountToDelete + 1); + if(err != 0) + THROW_CORE_EXCEPTION(eErr_InternalProblem); GetInternalStringData()->SetStringLength(stCurrentLength - stCountToDelete);