From 3ad6b2ca83aa3958b418e51cc832eb9e567555fb Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sun, 21 Apr 2019 01:08:47 +0000 Subject: pledge "stdio" after opening file and before doing operations from Rafael Neves --- usr.bin/nl/nl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'usr.bin/nl/nl.c') 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); -- cgit v1.2.3