4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-19 04:49:25 +08:00

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

View File

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