mirror of
https://github.com/openssl/openssl.git
synced 2024-11-29 13:03:55 +08:00
Make get_ip() a bit more strict in it's parsing of IP addresses, and
at the same time a bit more accepting with host names.
This commit is contained in:
parent
5abc8ae6f9
commit
b1460627f3
@ -494,16 +494,16 @@ static int get_ip(const char *str, unsigned char ip[4])
|
||||
{
|
||||
ok=1;
|
||||
tmp[num]=tmp[num]*10+c-'0';
|
||||
if (tmp[num] > 255) return(-1);
|
||||
if (tmp[num] > 255) return(0);
|
||||
}
|
||||
else if (c == '.')
|
||||
{
|
||||
if (!ok) return(-1);
|
||||
if (num == 3) break;
|
||||
if (num == 3) return(0);
|
||||
num++;
|
||||
ok=0;
|
||||
}
|
||||
else if ((num == 3) && ok)
|
||||
else if (c == '\0' && (num == 3) && ok)
|
||||
break;
|
||||
else
|
||||
return(0);
|
||||
|
Loading…
Reference in New Issue
Block a user