Fixed potential issue with read beyond buffer boundaries

This commit is contained in:
alexey.lysiuk 2015-04-05 11:52:57 +03:00
parent 82f7b439c8
commit 7b89312923

View file

@ -699,7 +699,12 @@ FString I_GetFromClipboard (bool use_primary_selection)
if (CFDataRef data = GetPasteboardData(itemID, kUTTypeUTF8PlainText))
{
result = reinterpret_cast<const char*>(CFDataGetBytePtr(data));
const CFIndex bufferLength = CFDataGetLength(data);
char* const buffer = result.LockNewBuffer(bufferLength);
memcpy(buffer, CFDataGetBytePtr(data), bufferLength);
result.UnlockBuffer();
}
else if (CFDataRef data = GetPasteboardData(itemID, kUTTypeUTF16PlainText))
{