]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: fd leak in sshd listen loop error path; from Gleb
authordjm@openbsd.org <djm@openbsd.org>
Thu, 18 Nov 2021 03:07:59 +0000 (03:07 +0000)
committerDamien Miller <djm@mindrot.org>
Thu, 18 Nov 2021 03:11:38 +0000 (14:11 +1100)
Smirnoff

OpenBSD-Commit-ID: a7a2be27a690a74bf2381bc16cea38e265657412

sshd.c

diff --git a/sshd.c b/sshd.c
index 432fc5be4ad1d25bf1e045b8c2d380e66c2f86eb..4e33cc92df761d9477b38bf96d4686fd74d21646 100644 (file)
--- a/sshd.c
+++ b/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
@@ -1264,8 +1264,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]);