334464 Crash when loading formhistory due to abuse of string APIs. Initialize using PRUnichar data with an explicit length. r=darin

This commit is contained in:
mark%moxienet.com 2006-04-24 23:31:14 +00:00
Родитель 3bdf60ea07
Коммит a8c7072023
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -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;