Fix for bug 105729. The string need to have at least the same amount of characters than the substring in order to compare them. R=varada, SR=alecf

This commit is contained in:
ducarroz%netscape.com 2001-11-06 23:06:24 +00:00
Родитель 62c6f9472d
Коммит efb5084eeb
1 изменённых файлов: 6 добавлений и 6 удалений

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

@ -251,13 +251,13 @@ nsAbAutoCompleteSession::AddToResult(const PRUnichar* pNickNameStr,
PR_Free(fullAddrStr);
}
static PRBool CommonPrefix(const PRUnichar *aString, const PRUnichar *aSubstr, PRInt32 aSubstrLen) {
PRUint32 len = MinInt(aSubstrLen, nsCRT::strlen(aString));
static PRBool CommonPrefix(const PRUnichar *aString, const PRUnichar *aSubstr, PRInt32 aSubstrLen)
{
if (aSubstrLen == 0 || nsCRT::strlen(aString) < aSubstrLen)
return PR_FALSE;
if (len == 0) return PR_FALSE;
return (Compare(nsDependentString(aString, len),
nsDependentString(aSubstr, len),
return (Compare(nsDependentString(aString, aSubstrLen),
nsDependentString(aSubstr, aSubstrLen),
nsCaseInsensitiveStringComparator()) == 0);
}