summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-10-05 06:17:05 +0000
committerderaadt <deraadt@openbsd.org>2015-10-05 06:17:05 +0000
commita0c491027adf190d2e6ee6f0dfc2fc14878b80ba (patch)
treecd9338ea461092c2435947a6483a59fac616dc6b
parentMake sure dot is not set after tz - fixes incorrect handling, which allows (diff)
downloadwireguard-openbsd-a0c491027adf190d2e6ee6f0dfc2fc14878b80ba.tar.xz
wireguard-openbsd-a0c491027adf190d2e6ee6f0dfc2fc14878b80ba.zip
tame "stdio rpath" is enough for the general case, which opens file
after file from argv. If it is discovered to be reading from stdin only, go to tame "stdio" ok doug
-rw-r--r--usr.bin/fmt/fmt.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/fmt/fmt.c b/usr.bin/fmt/fmt.c
index be4083ad80a..a5c95991355 100644
--- a/usr.bin/fmt/fmt.c
+++ b/usr.bin/fmt/fmt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fmt.c,v 1.30 2013/11/26 13:18:55 deraadt Exp $ */
+/* $OpenBSD: fmt.c,v 1.31 2015/10/05 06:17:05 deraadt Exp $ */
/* Sensible version of fmt
*
@@ -255,6 +255,9 @@ main(int argc, char *argv[])
(void)setlocale(LC_CTYPE, "");
+ if (tame("stdio rpath", NULL) == -1)
+ err(1, "tame");
+
/* 1. Grok parameters. */
while ((ch = getopt(argc, argv, "0123456789cd:hl:mnpst:w:")) != -1) {
switch (ch) {
@@ -337,6 +340,8 @@ main(int argc, char *argv[])
while (argc-- > 0)
process_named_file(*argv++);
} else {
+ if (tame("stdio", NULL) != 0)
+ err(1, "tame");
process_stream(stdin, "standard input");
}