From 1d36a22d7397a1e5e0b33acd24f757a73ad57bd5 Mon Sep 17 00:00:00 2001 From: deraadt Date: Wed, 7 Oct 2015 06:39:16 +0000 Subject: [PATCH] tame "stdio". It would take some doing for this to contain a bug, but just in case -- now it can barely do anything when it goes wrong. --- usr.bin/getopt/getopt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr.bin/getopt/getopt.c b/usr.bin/getopt/getopt.c index f0c3869181f..b0781e62058 100644 --- a/usr.bin/getopt/getopt.c +++ b/usr.bin/getopt/getopt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getopt.c,v 1.8 2009/10/27 23:59:38 deraadt Exp $ */ +/* $OpenBSD: getopt.c,v 1.9 2015/10/07 06:39:16 deraadt Exp $ */ /* * This material, written by Henry Spencer, was released by him @@ -8,6 +8,7 @@ #include #include #include +#include int main(int argc, char *argv[]) @@ -17,6 +18,9 @@ main(int argc, char *argv[]) int c; int status = 0; + if (tame("stdio", NULL) == -1) + err(1, "tame"); + optind = 2; /* Past the program name and the option letters. */ while ((c = getopt(argc, argv, argv[1])) != -1) switch (c) { -- 2.20.1