]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: Avoid kill with -1 argument. The out_ctx label can be
authordtucker@openbsd.org <dtucker@openbsd.org>
Fri, 27 May 2022 04:27:49 +0000 (04:27 +0000)
committerDarren Tucker <dtucker@dtucker.net>
Fri, 27 May 2022 04:59:17 +0000 (14:59 +1000)
reached before fork has been called. If this happens, then kill -1 would be
called, sending SIGTERM to all processes reachable by the current process.

From tobias@ and c3h2_ctf via github PR#286, ok djm@

OpenBSD-Commit-ID: 6277af1207d81202f5daffdccfeeaed4c763b1a8

readpass.c

index 39af25c887298a2da3553c3b0f5914bace77757a..b52f3d6b1e1a8c21d33a03932566121dd5278962 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: readpass.c,v 1.69 2021/07/23 05:56:47 djm Exp $ */
+/* $OpenBSD: readpass.c,v 1.70 2022/05/27 04:27:49 dtucker Exp $ */
 /*
  * Copyright (c) 2001 Markus Friedl.  All rights reserved.
  *
@@ -286,7 +286,8 @@ notify_start(int force_askpass, const char *fmt, ...)
        }
  out_ctx:
        if ((ret = calloc(1, sizeof(*ret))) == NULL) {
-               kill(pid, SIGTERM);
+               if (pid != -1)
+                       kill(pid, SIGTERM);
                fatal_f("calloc failed");
        }
        ret->pid = pid;