bug 100682 domain cookies from sites having IP url's, r=sgehani, sr=alecf

This commit is contained in:
morse%netscape.com 2001-09-21 02:08:21 +00:00
parent 7b84625e46
commit d678dcb719

View File

@ -405,6 +405,20 @@ PRBool
cookie_IsInDomain(char* domain, char* host, int hostLength) {
int domainLength = PL_strlen(domain);
/*
* test for domain name being an IP address (e.g., 105.217) and reject if so
*/
PRBool hasNonDigitChar = PR_FALSE;
for (int i = 0; i<domainLength; i++) {
if (!nsCRT::IsAsciiDigit(domain[i]) && domain[i] != '.') {
hasNonDigitChar = PR_TRUE;
break;
}
}
if (!hasNonDigitChar) {
return PR_FALSE;
}
/*
* special case for domainName = .hostName
* e.g., hostName = netscape.com