From: deraadt Date: Wed, 7 Oct 2015 06:39:16 +0000 (+0000) Subject: tame "stdio". It would take some doing for this to contain a bug, but X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1d36a22d7397a1e5e0b33acd24f757a73ad57bd5;p=openbsd 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. --- 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) {