Avoid buffer overrun by not using depreciated getCharacters method. Use getCharacters:range instead.
parent
7e92a24279
commit
7f50860af0
|
|
@ -91,10 +91,11 @@ const unsigned short *copyFromPBoard()
|
|||
NSArray *objToPaste = [pboard readObjectsForClasses:classArray options:[NSDictionary dictionary]];
|
||||
str = [objToPaste objectAtIndex:0];
|
||||
}
|
||||
unichar* temp = (unichar*)calloc([str length], sizeof(unichar));
|
||||
[str getCharacters:temp];
|
||||
NSUInteger len = [str length];
|
||||
unichar* buffer = (unichar*)calloc(len, sizeof(unichar));
|
||||
[str getCharacters:buffer range:NSMakeRange(0, len)];
|
||||
[pool release];
|
||||
return temp;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY)
|
||||
|
|
|
|||
|
|
@ -1153,8 +1153,8 @@ BOOL LLWindowMacOSX::isClipboardTextAvailable()
|
|||
|
||||
BOOL LLWindowMacOSX::pasteTextFromClipboard(LLWString &dst)
|
||||
{
|
||||
llutf16string str(copyFromPBoard());
|
||||
dst = utf16str_to_wstring(str);
|
||||
//llutf16string str(copyFromPBoard());
|
||||
dst = utf16str_to_wstring(copyFromPBoard());
|
||||
LLWStringUtil::removeCRLF(dst); // <FS:CR>
|
||||
if (dst != L"")
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue