summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-04-21 01:08:47 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-04-21 01:08:47 +0000
commit3ad6b2ca83aa3958b418e51cc832eb9e567555fb (patch)
tree9df76d3cdae5c0064e2bdc93c5c72aa37325dd99
parent76f09247f7c887ad41b351ea07ed02741e04927c (diff)
pledge "stdio" after opening file and before doing operations
from Rafael Neves
-rw-r--r--usr.bin/nl/nl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/nl/nl.c b/usr.bin/nl/nl.c
index e4c1e2d6177..0edfd359092 100644
--- a/usr.bin/nl/nl.c
+++ b/usr.bin/nl/nl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nl.c,v 1.6 2015/10/09 01:37:08 deraadt Exp $ */
+/* $OpenBSD: nl.c,v 1.7 2019/04/21 01:08:46 deraadt Exp $ */
/* $NetBSD: nl.c,v 1.11 2011/08/16 12:00:46 christos Exp $ */
/*-
@@ -218,6 +218,9 @@ main(int argc, char *argv[])
/* NOTREACHED */
}
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
+
/* Generate the delimiter sequence */
memcpy(delim, delim1, delim1len);
memcpy(delim + delim1len, delim2, delim2len);