Added proper return value checks for clipboard data.

This commit is contained in:
Armin Novak 2018-05-02 09:21:42 +02:00
parent 8cba201999
commit a1c3c1ad64
2 changed files with 9 additions and 0 deletions

View File

@ -1422,6 +1422,14 @@ static UINT xf_cliprdr_server_format_data_response(CliprdrClientContext*
DstSize = 0;
pDstData = (BYTE*) ClipboardGetData(clipboard->system, dstFormatId, &DstSize);
if (!pDstData)
{
WLog_ERR(TAG, "failed to get clipboard data in format %s [source format %s]",
ClipboardGetFormatName(clipboard, dstFormatId),
ClipboardGetFormatName(clipboard, srcFormatId));
return ERROR_INTERNAL_ERROR;
}
if (nullTerminated)
{
while (DstSize > 0 && pDstData[DstSize - 1] == '\0')

View File

@ -436,6 +436,7 @@ void* ClipboardGetData(wClipboard* clipboard, UINT32 formatId, UINT32* pSize)
if (!pSize)
return NULL;
*pSize = 0;
format = ClipboardFindFormat(clipboard, clipboard->formatId, NULL);
if (!format)