added more robust/accurate numeric ip address check
git-svn-id: svn://10.0.0.236/trunk@46851 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
d444fffb40
commit
8b70f352bf
@ -533,7 +533,15 @@ nsresult nsSocketTransport::doResolveHost(void)
|
||||
char dbbuf[PR_NETDB_BUF_SIZE];
|
||||
PRHostEnt hostEnt;
|
||||
|
||||
if (nsString2::IsDigit(mHostName[0])) {
|
||||
PRBool numeric = PR_TRUE;
|
||||
for (char *hostCheck = mHostName; *hostCheck; hostCheck++) {
|
||||
if (!nsString2::IsDigit(*hostCheck) && (*hostCheck != '.') ) {
|
||||
numeric = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (numeric) {
|
||||
PRNetAddr *netAddr = (PRNetAddr*)nsAllocator::Alloc(sizeof(PRNetAddr));
|
||||
status = PR_StringToNetAddr(mHostName, netAddr);
|
||||
if (PR_SUCCESS != status) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user