summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-03 12:41:17 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-03 12:41:17 +0000
commit3b07d13c42741940e476f3ab023079203976fb48 (patch)
treeb759703d4690a83ddc1098b474f0cb7d5d68bd0e
parentaa94384153f93ed2f1cd947284e962a7d26950c8 (diff)
tame "stdio" right between setlocale and getopt, it is easy to review
this program and see it does uname(3) and stdio printf. uname(3) is backed by a cluster of sysctl() reads, all permitted by the kernel in tame_sysctl_check()
-rw-r--r--usr.bin/uname/uname.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/uname/uname.c b/usr.bin/uname/uname.c
index 15e7f907308..85ac7dc1186 100644
--- a/usr.bin/uname/uname.c
+++ b/usr.bin/uname/uname.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uname.c,v 1.14 2015/07/21 16:22:59 jasper Exp $ */
+/* $OpenBSD: uname.c,v 1.15 2015/10/03 12:41:16 deraadt Exp $ */
/*
* Copyright (c) 1994 Winning Strategies, Inc.
@@ -59,6 +59,9 @@ main(int argc, char *argv[])
setlocale(LC_ALL, "");
+ if (tame("stdio", NULL) == -1)
+ err(1, "tame");
+
while ((c = getopt(argc, argv, "amnrsvp")) != -1 ) {
switch (c) {
case 'a':