mirror of
https://github.com/samba-team/samba.git
synced 2025-02-23 09:57:40 +03:00
tsocket: allow AF_UNIX sockaddrs smaller than sizeof(sockaddr_un)
This is needed as getpeername() truncates the length to 2 if the peer socket has no name. metze
This commit is contained in:
parent
96207912cb
commit
4784c8c3be
@ -210,12 +210,13 @@ int _tsocket_address_bsd_from_sockaddr(TALLOC_CTX *mem_ctx,
|
||||
struct tsocket_address *addr;
|
||||
struct tsocket_address_bsd *bsda;
|
||||
|
||||
if (sa_socklen < sizeof(sa->sa_family)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (sa->sa_family) {
|
||||
case AF_UNIX:
|
||||
if (sa_socklen < sizeof(struct sockaddr_un)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case AF_INET:
|
||||
if (sa_socklen < sizeof(struct sockaddr_in)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user