diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-10-03 02:18:21 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-10-03 02:18:21 +0000 |
commit | efed3bc136ab175fcf7cfe61fd0b35383cfd0dcc (patch) | |
tree | 3e81eee5c8a802f387cbde6c65f5693b50c0bf2a | |
parent | 8d1da5b042b7bf4fe430b3219982a157303f6826 (diff) |
uniq has a complicated initialization around getopt. beforehands, we
can tame "stdio rpath wpath cpath"; all three paths abilities are needed
for it to setup the right files (worst case spotted by sthen). later
once the files are opened, the program is only looking at strings and
outputing via stdio functions, so we can tame "stdio".
-rw-r--r-- | usr.bin/uniq/uniq.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.bin/uniq/uniq.c b/usr.bin/uniq/uniq.c index 7645f85062f..69dcf28c7ac 100644 --- a/usr.bin/uniq/uniq.c +++ b/usr.bin/uniq/uniq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uniq.c,v 1.19 2013/11/26 19:25:39 deraadt Exp $ */ +/* $OpenBSD: uniq.c,v 1.20 2015/10/03 02:18:20 deraadt Exp $ */ /* $NetBSD: uniq.c,v 1.7 1995/08/31 22:03:48 jtc Exp $ */ /* @@ -61,6 +61,9 @@ main(int argc, char *argv[]) int ch; char *prevline, *thisline; + if (tame("stdio rpath wpath cpath", NULL) == -1) + err(1, "tame"); + obsolete(argv); while ((ch = getopt(argc, argv, "cdf:s:u")) != -1) { const char *errstr; @@ -119,6 +122,9 @@ main(int argc, char *argv[]) usage(); } + if (tame("stdio", NULL) != 0) + err(1, "tame"); + prevline = malloc(MAXLINELEN); thisline = malloc(MAXLINELEN); if (prevline == NULL || thisline == NULL) |