mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
Fixed potential issue with read beyond buffer boundaries
This commit is contained in:
parent
82f7b439c8
commit
7b89312923
1 changed files with 6 additions and 1 deletions
|
@ -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))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue