]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/string.cpp
wxUSE_XXX related fixes
[wxWidgets.git] / src / common / string.cpp
index d448b4b306203ad4468b3614f4eca01739524eae..6ddd68f0c7cfb69441da9a37452ca44fb5268189 100644 (file)
@@ -380,7 +380,9 @@ bool wxStringBase::Alloc(size_t nLen)
         // allocation failure handled by caller
         return false;
       }
-      memcpy(m_pchData, pData->data(), nOldLen*sizeof(wxChar));
+      // +1 to copy the terminator, too
+      memcpy(m_pchData, pData->data(), (nOldLen+1)*sizeof(wxChar));
+      GetStringData()->nDataLength = nOldLen;
     }
     else {
       nLen += EXTRA_ALLOC;