From: deraadt Date: Tue, 6 Oct 2015 13:29:56 +0000 (+0000) Subject: tame "stdio rpath" before opening the file, tame "stdio" after that X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=81748d5067b0c030dc5e8d055bb33141c7f88b35;p=openbsd tame "stdio rpath" before opening the file, tame "stdio" after that --- diff --git a/usr.bin/units/units.c b/usr.bin/units/units.c index df222dee88d..b4b7e6e8049 100644 --- a/usr.bin/units/units.c +++ b/usr.bin/units/units.c @@ -1,4 +1,4 @@ -/* $OpenBSD: units.c,v 1.20 2013/11/27 00:13:24 deraadt Exp $ */ +/* $OpenBSD: units.c,v 1.21 2015/10/06 13:29:56 deraadt Exp $ */ /* $NetBSD: units.c,v 1.6 1996/04/06 06:01:03 thorpej Exp $ */ /* @@ -23,6 +23,7 @@ #include #include #include +#include #define UNITSFILE "/usr/share/misc/units.lib" @@ -631,6 +632,9 @@ main(int argc, char **argv) extern char *optarg; extern int optind; + if (tame("stdio rpath", NULL) == -1) + err(1, "tame"); + while ((optchar = getopt(argc, argv, "vqf:")) != -1) { switch (optchar) { case 'f': @@ -660,6 +664,9 @@ main(int argc, char **argv) readunits(userfile); + if (tame("stdio", NULL) == -1) + err(1, "tame"); + if (argc == 3) { strlcpy(havestr, argv[0], sizeof(havestr)); strlcat(havestr, " ", sizeof(havestr));