Fix the size of the buffer when using wxIPC::Execute() with DDE.
Don't multiply the "realSize" variable by sizeof(wxChar) when passing it to DdeClientTransaction(), as its name indicates it is already supposed to be the size of the data and not the length of the string so just ensure that it is always correctly set to the size and not length when initializing it. Closes #13734. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69943 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
30e92ba333
commit
5e9d3bf799
@ -593,6 +593,10 @@ wxDDEConnection::DoExecute(const void *data, size_t size, wxIPCFormat format)
|
|||||||
realSize = conv->ToWChar((wchar_t *)realData, realSize, text, len);
|
realSize = conv->ToWChar((wchar_t *)realData, realSize, text, len);
|
||||||
if ( realSize == wxCONV_FAILED )
|
if ( realSize == wxCONV_FAILED )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// We need to pass the size of the buffer to DdeClientTransaction() and
|
||||||
|
// not the length of the string.
|
||||||
|
realSize *= sizeof(wchar_t);
|
||||||
}
|
}
|
||||||
#else // !wxUSE_UNICODE
|
#else // !wxUSE_UNICODE
|
||||||
if ( format == wxIPC_UNICODETEXT )
|
if ( format == wxIPC_UNICODETEXT )
|
||||||
@ -635,7 +639,7 @@ wxDDEConnection::DoExecute(const void *data, size_t size, wxIPCFormat format)
|
|||||||
|
|
||||||
DWORD result;
|
DWORD result;
|
||||||
bool ok = DdeClientTransaction(realData,
|
bool ok = DdeClientTransaction(realData,
|
||||||
realSize*sizeof(wxChar),
|
realSize,
|
||||||
GetHConv(),
|
GetHConv(),
|
||||||
NULL,
|
NULL,
|
||||||
// MSDN: if the transaction specified by
|
// MSDN: if the transaction specified by
|
||||||
|
Loading…
Reference in New Issue
Block a user