Cygwin: AF_UNIX: accept4: copy trailing NUL byte

If the caller has requested the peer's address, include the trailing
NUL byte of the address if possible.
This commit is contained in:
Ken Brown 2020-10-07 07:07:18 -04:00
parent a0dd60f857
commit 0f800bf44a
1 changed files with 1 additions and 1 deletions

View File

@ -1665,7 +1665,7 @@ fhandler_socket_unix::accept4 (struct sockaddr *peer, int *len, int flags)
if (sun) if (sun)
{ {
memcpy (peer, &sun->un, memcpy (peer, &sun->un,
MIN (*len, sun->un_len)); MIN (*len, sun->un_len + 1));
*len = sun->un_len; *len = sun->un_len;
} }
else if (len) else if (len)