Changed to pad one more null byte after a collation key, bug 15142, r=putterman.

This commit is contained in:
nhotta%netscape.com 2000-08-28 22:32:01 +00:00
Родитель 6c01a69c97
Коммит 966f9567c0
2 изменённых файлов: 4 добавлений и 2 удалений

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

@ -4091,7 +4091,7 @@ nsresult nsAddrDatabase::GetCollationKeyGenerator()
rv = m_collationKeyGenerator->GetSortKeyLen(kCollationCaseInSensitive, sourceString, &aLength);
if (NS_SUCCEEDED(rv))
{
aKey = (PRUint8 *) PR_Malloc(aLength + 2); // plus two for null termination
aKey = (PRUint8 *) PR_Malloc(aLength + 3); // plus three for null termination
if (aKey)
{
rv = m_collationKeyGenerator->CreateRawSortKey(kCollationCaseInSensitive, sourceString, aKey, &aLength);
@ -4101,6 +4101,7 @@ nsresult nsAddrDatabase::GetCollationKeyGenerator()
// Note using PRUnichar* to store collation key is not recommented since the key may contains 0x0000.
aKey[aLength] = 0;
aKey[aLength+1] = 0;
aKey[aLength+2] = 0;
resultStr.Assign((PRUnichar *) aKey);
}
else

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

@ -2653,7 +2653,7 @@ nsresult nsMsgDatabase::RowCellColumnToCollationKey(nsIMdbRow *row, mdb_token co
err = m_collationKeyGenerator->GetSortKeyLen(kCollationCaseInSensitive, sourceStr, &aLength);
if (NS_SUCCEEDED(err))
{
aKey = (PRUint8 *) PR_Malloc(aLength + 2); // plus two for null termination
aKey = (PRUint8 *) PR_Malloc(aLength + 3); // plus three for null termination
if (aKey)
{
err = m_collationKeyGenerator->CreateRawSortKey(kCollationCaseInSensitive, sourceStr, aKey, &aLength);
@ -2663,6 +2663,7 @@ nsresult nsMsgDatabase::RowCellColumnToCollationKey(nsIMdbRow *row, mdb_token co
// Note using PRUnichar* to store collation key is not recommented since the key may contains 0x0000.
aKey[aLength] = 0;
aKey[aLength+1] = 0;
aKey[aLength+2] = 0;
*resultString = (PRUnichar *) aKey;
}
else