fix off-by-one error in wcscpy_s parameter list causing crash when copying error dialog text
closes #454 Thanks to Erik for reporting this! This was SVN commit r7303.
This commit is contained in:
parent
1fb9a1768e
commit
50b79962ad
@ -24,15 +24,15 @@
|
||||
// caller is responsible for freeing *hMem.
|
||||
static LibError SetClipboardText(const wchar_t* text, HGLOBAL* hMem)
|
||||
{
|
||||
const size_t len = wcslen(text);
|
||||
*hMem = GlobalAlloc(GMEM_MOVEABLE, (len+1) * sizeof(wchar_t));
|
||||
const size_t numChars = wcslen(text);
|
||||
*hMem = GlobalAlloc(GMEM_MOVEABLE, (numChars+1) * sizeof(wchar_t));
|
||||
if(!*hMem)
|
||||
WARN_RETURN(ERR::NO_MEM);
|
||||
|
||||
wchar_t* lockedText = (wchar_t*)GlobalLock(*hMem);
|
||||
if(!lockedText)
|
||||
WARN_RETURN(ERR::NO_MEM);
|
||||
wcscpy_s(lockedText, len, text);
|
||||
wcscpy_s(lockedText, numChars+1, text);
|
||||
GlobalUnlock(*hMem);
|
||||
|
||||
HANDLE hData = SetClipboardData(CF_UNICODETEXT, *hMem);
|
||||
|
Loading…
Reference in New Issue
Block a user