[torsocks/master] Fix: accept{4} wrappers to accept addr to NULL

commit 67d9b1a4620445bfb271d64a7799ef22487fabfa Author: David Goulet <dgoulet@ev0ke.net> Date: Tue Jun 14 10:40:18 2016 -0400 Fix: accept{4} wrappers to accept addr to NULL The accept(2) man page specifies that addr can be a NULL pointer for both accept() and accept4(). This has been reported in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=811266 Signed-off-by: David Goulet <dgoulet@ev0ke.net> --- src/lib/accept.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/lib/accept.c b/src/lib/accept.c index 21714cb..80434fc 100644 --- a/src/lib/accept.c +++ b/src/lib/accept.c @@ -37,11 +37,6 @@ LIBC_ACCEPT_RET_TYPE tsocks_accept(LIBC_ACCEPT_SIG) goto libc_call; } - if (!addr) { - errno = EFAULT; - goto error; - } - sa_len = sizeof(sa); ret = getsockname(sockfd, &sa, &sa_len); @@ -61,11 +56,10 @@ LIBC_ACCEPT_RET_TYPE tsocks_accept(LIBC_ACCEPT_SIG) /* Inbound localhost connections are allowed. */ ret = utils_sockaddr_is_localhost(&sa); if (!ret) { - /* * Accept is completely denied here since this means that the - * application can accept inbound connections on non localhost that are - * obviously NOT handled by the Tor network thus reject this call. + * application can accept inbound connections on non localhost that + * are obviously NOT handled by the Tor network thus reject this call. */ DBG("[accept] Non localhost inbound connection are not allowed."); errno = EPERM; @@ -111,11 +105,6 @@ LIBC_ACCEPT4_RET_TYPE tsocks_accept4(LIBC_ACCEPT4_SIG) goto libc_call; } - if (!addr) { - errno = EFAULT; - goto error; - } - sa_len = sizeof(sa); ret = getsockname(sockfd, &sa, &sa_len);
participants (1)
-
dgoulet@torproject.org