mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-04 09:09:56 +00:00
Check if a host argument is a IPv6 presentation format address before
going to gethostbyname2(3). PR: bin/31632 MFC after: 3 days
This commit is contained in:
parent
6508a194aa
commit
0b3a80af0d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=102400
@ -548,13 +548,13 @@ lookup_host (host, addr, family)
|
||||
char *host;
|
||||
u_char *addr;
|
||||
{
|
||||
struct hostent *he = gethostbyname2(host, family);
|
||||
|
||||
if (!he)
|
||||
return(-1);
|
||||
|
||||
memcpy(addr, he->h_addr_list[0], he->h_length);
|
||||
struct hostent *he;
|
||||
|
||||
if (inet_pton(family, host, addr) != 1) {
|
||||
if ((he = gethostbyname2(host, family)) == NULL)
|
||||
return(-1);
|
||||
memcpy(addr, he->h_addr_list[0], he->h_length);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user