summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-10-07 06:55:10 +0000
committerderaadt <deraadt@openbsd.org>2015-10-07 06:55:10 +0000
commit1d55daa8521aafa4f745e3effb43478d3935a269 (patch)
treecfc06faa6f35739bc36ad67a0bb8b5b473c7b43d
parenttame "stdio rpath getpw" before getpwuid and opening, then tame "stdio" (diff)
downloadwireguard-openbsd-1d55daa8521aafa4f745e3effb43478d3935a269.tar.xz
wireguard-openbsd-1d55daa8521aafa4f745e3effb43478d3935a269.zip
tame "stdio rpath" initially. if no files, go to tame "stdio".
-rw-r--r--usr.bin/head/head.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/head/head.c b/usr.bin/head/head.c
index 3e94eb5761b..e5120e48d36 100644
--- a/usr.bin/head/head.c
+++ b/usr.bin/head/head.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: head.c,v 1.18 2014/10/08 08:31:53 schwarze Exp $ */
+/* $OpenBSD: head.c,v 1.19 2015/10/07 06:55:10 deraadt Exp $ */
/*
* Copyright (c) 1980, 1987 Regents of the University of California.
@@ -55,6 +55,9 @@ main(int argc, char *argv[])
char *p = NULL;
int status = 0;
+ if (tame("stdio rpath", NULL) == -1)
+ err(1, "tame");
+
/* handle obsolete -number syntax */
if (argc > 1 && argv[1][0] == '-' &&
isdigit((unsigned char)argv[1][1])) {
@@ -87,6 +90,8 @@ main(int argc, char *argv[])
if (!firsttime)
exit(status);
fp = stdin;
+ if (tame("stdio", NULL) == -1)
+ err(1, "tame");
} else {
if ((fp = fopen(*argv, "r")) == NULL) {
warn("%s", *argv++);