fix another WC2MB off-by-one error

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@56402 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-10-17 13:45:34 +00:00
parent 753874333a
commit c8e0da59d8

View File

@@ -259,8 +259,14 @@ selection_handler( GtkWidget *WXUNUSED(widget),
{
const wchar_t *wstr = (const wchar_t *)d;
size_t len = wxConvCurrent->WC2MB(NULL, wstr, 0);
if ( len == wxCONV_FAILED )
{
free(d);
return;
}
char *str = malloc(len + 1);
wxConvCurrent->WC2MB(str, wstr, len);
wxConvCurrent->WC2MB(str, wstr, len + 1);
str[len] = '\0';
free(d);