From a8c70720235c24a018ffacef345f719ab0c8189b Mon Sep 17 00:00:00 2001 From: "mark%moxienet.com" Date: Mon, 24 Apr 2006 23:31:14 +0000 Subject: [PATCH] 334464 Crash when loading formhistory due to abuse of string APIs. Initialize using PRUnichar data with an explicit length. r=darin --- toolkit/components/satchel/src/nsFormHistory.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/toolkit/components/satchel/src/nsFormHistory.cpp b/toolkit/components/satchel/src/nsFormHistory.cpp index 37aa1df23a4..ed8b0f8a0e8 100644 --- a/toolkit/components/satchel/src/nsFormHistory.cpp +++ b/toolkit/components/satchel/src/nsFormHistory.cpp @@ -938,12 +938,12 @@ nsFormHistory::InitByteOrder(PRBool aForce) // bigEndian and littleEndian are endianness markers that are stored in // the formhistory db as UTF-16. Define them to be strings easily // recognized in either endianness. - nsAutoString bigEndianByteOrder((PRUnichar*)"BBBB"); - nsAutoString littleEndianByteOrder((PRUnichar*)"llll"); + nsAutoString bigEndianByteOrder((PRUnichar*)"BBBB", 2); + nsAutoString littleEndianByteOrder((PRUnichar*)"llll", 2); #ifdef IS_BIG_ENDIAN - nsAutoString nativeByteOrder(bigEndianByteOrder); + nsAutoString& nativeByteOrder(bigEndianByteOrder); #else - nsAutoString nativeByteOrder(littleEndianByteOrder); + nsAutoString& nativeByteOrder(littleEndianByteOrder); #endif nsAutoString fileByteOrder;