From d310ad95fe6a0db91654b092b40c1c5490b3a82c Mon Sep 17 00:00:00 2001 From: deraadt Date: Sat, 10 Oct 2015 14:23:46 +0000 Subject: [PATCH] fairly obvious pledges. ok doug --- usr.bin/unexpand/unexpand.c | 6 +++++- usr.bin/yacc/main.c | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/usr.bin/unexpand/unexpand.c b/usr.bin/unexpand/unexpand.c index 89e4f23f3fa..e61e61d1211 100644 --- a/usr.bin/unexpand/unexpand.c +++ b/usr.bin/unexpand/unexpand.c @@ -1,4 +1,4 @@ -/* $OpenBSD: unexpand.c,v 1.10 2009/10/27 23:59:46 deraadt Exp $ */ +/* $OpenBSD: unexpand.c,v 1.11 2015/10/10 14:23:46 deraadt Exp $ */ /* $NetBSD: unexpand.c,v 1.5 1994/12/24 17:08:05 cgd Exp $ */ /*- @@ -36,6 +36,7 @@ #include #include #include +#include char genbuf[BUFSIZ]; char linebuf[BUFSIZ]; @@ -48,6 +49,9 @@ main(int argc, char *argv[]) { char *cp; + if (pledge("stdio rpath", NULL) == -1) + perror("pledge"); + argc--, argv++; if (argc > 0 && argv[0][0] == '-') { if (strcmp(argv[0], "-a") != 0) { diff --git a/usr.bin/yacc/main.c b/usr.bin/yacc/main.c index 354a269b548..29df0cfd886 100644 --- a/usr.bin/yacc/main.c +++ b/usr.bin/yacc/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.26 2014/03/13 00:33:55 tedu Exp $ */ +/* $OpenBSD: main.c,v 1.27 2015/10/10 14:23:47 deraadt Exp $ */ /* $NetBSD: main.c,v 1.5 1996/03/19 03:21:38 jtc Exp $ */ /* @@ -347,6 +347,9 @@ open_files(void) int main(int argc, char *argv[]) { + if (pledge("stdio rpath wpath cpath", NULL) == -1) + fatal("pledge: invalid arguments"); + set_signals(); getargs(argc, argv); open_files(); -- 2.20.1