mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1159604: Use a fallible allocation in nsClipboard::GetGlobalData. r=bbondy
This commit is contained in:
parent
0e505c7df5
commit
5ea519db71
@ -282,7 +282,7 @@ nsresult nsClipboard::GetGlobalData(HGLOBAL aHGBL, void ** aData, uint32_t * aLe
|
||||
if (aHGBL != nullptr) {
|
||||
LPSTR lpStr = (LPSTR) GlobalLock(aHGBL);
|
||||
DWORD allocSize = GlobalSize(aHGBL);
|
||||
char* data = static_cast<char*>(moz_xmalloc(allocSize + sizeof(char16_t)));
|
||||
char* data = static_cast<char*>(malloc(allocSize + sizeof(char16_t)));
|
||||
if ( data ) {
|
||||
memcpy ( data, lpStr, allocSize );
|
||||
data[allocSize] = data[allocSize + 1] = '\0'; // null terminate for safety
|
||||
|
Loading…
Reference in New Issue
Block a user