summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/sshpty.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2019-07-04 16:20:10 +0000
committerderaadt <deraadt@openbsd.org>2019-07-04 16:20:10 +0000
commit716298432411974a03b5bc355dd1990aad319877 (patch)
tree14a6b2c6f2171108f5ff2ff48d17ea1bf6d204d2 /usr.bin/ssh/sshpty.c
parentstat() returns precisely -1 to indicate error (diff)
downloadwireguard-openbsd-716298432411974a03b5bc355dd1990aad319877.tar.xz
wireguard-openbsd-716298432411974a03b5bc355dd1990aad319877.zip
fatal() if getgrnam() cannot find "tty"
Diffstat (limited to 'usr.bin/ssh/sshpty.c')
-rw-r--r--usr.bin/ssh/sshpty.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/ssh/sshpty.c b/usr.bin/ssh/sshpty.c
index 5eeffb89d6e..faf8960cfb5 100644
--- a/usr.bin/ssh/sshpty.c
+++ b/usr.bin/ssh/sshpty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshpty.c,v 1.33 2019/07/04 16:16:51 deraadt Exp $ */
+/* $OpenBSD: sshpty.c,v 1.34 2019/07/04 16:20:10 deraadt Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -141,6 +141,8 @@ pty_setowner(struct passwd *pw, const char *tty)
/* Determine the group to make the owner of the tty. */
grp = getgrnam("tty");
+ if (grp == NULL)
+ fatal("no tty group");
gid = (grp != NULL) ? grp->gr_gid : pw->pw_gid;
mode = (grp != NULL) ? 0620 : 0600;