summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2021-11-18 03:08:00 +0000
committerDamien Miller <djm@cvs.openbsd.org>2021-11-18 03:08:00 +0000
commit66829e9e3ba62e81bb88c1f39beb9036d5f1ce02 (patch)
treee776c0b9c0d5758ab1f6389512aecd96485721e7
parent86e68bfd1cf91f42aff919ceade0fabfa6d53d58 (diff)
fd leak in sshd listen loop error path; from Gleb Smirnoff
-rw-r--r--usr.bin/ssh/sshd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c
index 29adda33f84..3c21b3df62c 100644
--- a/usr.bin/ssh/sshd.c
+++ b/usr.bin/ssh/sshd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshd.c,v 1.581 2021/11/18 03:07:20 djm Exp $ */
+/* $OpenBSD: sshd.c,v 1.582 2021/11/18 03:07:59 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1211,8 +1211,10 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s)
continue;
}
if (unset_nonblock(*newsock) == -1 ||
- pipe(startup_p) == -1)
+ pipe(startup_p) == -1) {
+ close(*newsock);
continue;
+ }
if (drop_connection(*newsock, startups, startup_p[0])) {
close(*newsock);
close(startup_p[0]);