summaryrefslogtreecommitdiff
path: root/usr.bin/mesg
diff options
context:
space:
mode:
authorSebastien Marie <semarie@cvs.openbsd.org>2016-07-07 09:26:27 +0000
committerSebastien Marie <semarie@cvs.openbsd.org>2016-07-07 09:26:27 +0000
commitbb3f7a6f2e480f0dbe9ba1ff2748ceca7871eb1d (patch)
treef4c82ffa9e8ed8f627a347c0de77c138c1751d67 /usr.bin/mesg
parent0f429a3e055bb483d898517ce1786569700b42e8 (diff)
biff, mesg, vi: only consider ACCESSPERMS for setting tty mode.
it explicitly removes any S_ISUID|S_ISGID|S_ISTXT bits, instead of letting pledge(2) silenciously remove them. ok beck@ deraadt@
Diffstat (limited to 'usr.bin/mesg')
-rw-r--r--usr.bin/mesg/mesg.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/mesg/mesg.c b/usr.bin/mesg/mesg.c
index 1d1265e4bd1..e7e960094e9 100644
--- a/usr.bin/mesg/mesg.c
+++ b/usr.bin/mesg/mesg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mesg.c,v 1.11 2016/01/25 21:59:36 gsoares Exp $ */
+/* $OpenBSD: mesg.c,v 1.12 2016/07/07 09:26:26 semarie Exp $ */
/* $NetBSD: mesg.c,v 1.4 1994/12/23 07:16:32 jtc Exp $ */
/*
@@ -69,6 +69,8 @@ main(int argc, char *argv[])
if (stat(tty, &sb) < 0)
err(2, "%s", tty);
+ sb.st_mode &= ACCESSPERMS;
+
if (*argv == NULL) {
if (sb.st_mode & S_IWGRP) {
(void)fprintf(stderr, "is y\n");