diff options
author | dtucker@openbsd.org <dtucker@openbsd.org> | 2022-05-27 04:27:49 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@dtucker.net> | 2022-05-27 14:59:17 +1000 |
commit | 5d3a77f4c5ae774c6796387266503f52c7cdc7c2 (patch) | |
tree | dadfedcd5a057a3935bc71eec9b52396af9aa578 /readpass.c | |
parent | 533b31cd08e4b97f455466f91c36915e2924c15a (diff) | |
download | openssh-git-5d3a77f4c5ae774c6796387266503f52c7cdc7c2.tar.gz |
upstream: Avoid kill with -1 argument. The out_ctx label can be
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
Diffstat (limited to 'readpass.c')
-rw-r--r-- | readpass.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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; |