mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Fix topcrash bug 96563 by reading only the number of characters of string that we have, rather than double that number. r=pavlov sr=blizzard
This commit is contained in:
parent
f4453db167
commit
22063f0ab5
@ -33,6 +33,7 @@
|
||||
#include "nsCRT.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
@ -908,8 +909,8 @@ void nsClipboard::SelectionGetCB(GtkWidget *widget,
|
||||
} else if (type.Equals("UTF8_STRING")) {
|
||||
if (clipboardData) {
|
||||
PRUnichar* castedUnicode = NS_REINTERPRET_CAST(PRUnichar*, clipboardData);
|
||||
nsString str(castedUnicode, dataLength);
|
||||
char *utf8String = str.ToNewUTF8String();
|
||||
char *utf8String =
|
||||
ToNewUTF8String(nsDependentString(castedUnicode, dataLength/2));
|
||||
nsMemory::Free(NS_REINTERPRET_CAST(char*, clipboardData));
|
||||
clipboardData = utf8String;
|
||||
dataLength = strlen(utf8String);
|
||||
|
Loading…
Reference in New Issue
Block a user