fix for conversion buffer size problems

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17628 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-10-25 00:15:05 +00:00
parent f481b72d90
commit 4d2912d600

View File

@@ -251,7 +251,8 @@ wxString::wxString(const char *psz, wxMBConv& conv, size_t nLength)
return;
}
if ( conv.MB2WC(m_pchData, psz, nLen) != (size_t)-1 )
// MB2WC wants the buffer size, not the string length
if ( conv.MB2WC(m_pchData, psz, nLen + 1) != (size_t)-1 )
{
// initialized ok
return;
@@ -290,7 +291,8 @@ wxString::wxString(const wchar_t *pwz, wxMBConv& conv, size_t nLength)
return;
}
if ( conv.WC2MB(m_pchData, pwz, nLen) != (size_t)-1 )
// WC2MB wants the buffer size, not the string length
if ( conv.WC2MB(m_pchData, pwz, nLen + 1) != (size_t)-1 )
{
// initialized ok
return;