mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-05 09:14:03 +00:00
sdl->sdl_len in sockaddr_dl can be longer than
sizeof(struct sockaddr_dl).
This commit is contained in:
parent
a096257482
commit
c56e91b345
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=290318
@ -122,7 +122,8 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen,
|
||||
afd = find_afd(sa->sa_family);
|
||||
if (afd == NULL)
|
||||
return (EAI_FAMILY);
|
||||
if (sa->sa_family == PF_LOCAL) {
|
||||
switch (sa->sa_family) {
|
||||
case PF_LOCAL:
|
||||
/*
|
||||
* PF_LOCAL uses variable sa->sa_len depending on the
|
||||
* content length of sun_path. Require 1 byte in
|
||||
@ -132,8 +133,17 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen,
|
||||
salen <= afd->a_socklen -
|
||||
sizeofmember(struct sockaddr_un, sun_path))
|
||||
return (EAI_FAIL);
|
||||
} else if (salen != afd->a_socklen)
|
||||
return (EAI_FAIL);
|
||||
break;
|
||||
case PF_LINK:
|
||||
if (salen <= afd->a_socklen -
|
||||
sizeofmember(struct sockaddr_dl, sdl_data))
|
||||
return (EAI_FAIL);
|
||||
break;
|
||||
default:
|
||||
if (salen != afd->a_socklen)
|
||||
return (EAI_FAIL);
|
||||
break;
|
||||
}
|
||||
|
||||
return ((*afd->a_func)(afd, sa, salen, host, hostlen,
|
||||
serv, servlen, flags));
|
||||
|
Loading…
Reference in New Issue
Block a user