From cf03a9be9c8ef1d7a340321f60f49da5782e9bd1 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Tue, 24 Aug 2004 04:59:26 +0000 Subject: [PATCH] Make sure to properly initialize 'size' to sizeof(sin) before passing it into accept(). Depending on the initial value in memory, it is otherwise possible to get EINVAL. --- tools/regression/sockets/accept_fd_leak/accept_fd_leak.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/regression/sockets/accept_fd_leak/accept_fd_leak.c b/tools/regression/sockets/accept_fd_leak/accept_fd_leak.c index 6d81eb903f68..4ee85e1d095f 100644 --- a/tools/regression/sockets/accept_fd_leak/accept_fd_leak.c +++ b/tools/regression/sockets/accept_fd_leak/accept_fd_leak.c @@ -107,6 +107,7 @@ main(int argc, char *argv[]) } for (i = 0; i < LOOPS; i++) { + size = sizeof(sin); if (accept(s, (struct sockaddr *)&sin, &size) != -1) { fprintf(stderr, "accept succeeded!\n"); exit(-1);