From 5117cd2872e582a1233cdfaea7760eb050235d5c Mon Sep 17 00:00:00 2001 From: schwarze Date: Wed, 11 Jul 2018 11:42:17 +0000 Subject: [PATCH] After opening all the needed files, tighten the pledge(2) from "stdio rpath" to just "stdio", before parsing any user data. It may not matter that much just yet, but parsing will become slightly more complicated soon when i shall add UTF-8 handling. OK millert@ --- usr.bin/lam/lam.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr.bin/lam/lam.c b/usr.bin/lam/lam.c index c7bac5bd7cd..1e169eff265 100644 --- a/usr.bin/lam/lam.c +++ b/usr.bin/lam/lam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lam.c,v 1.20 2018/07/11 11:35:06 schwarze Exp $ */ +/* $OpenBSD: lam.c,v 1.21 2018/07/11 11:42:17 schwarze Exp $ */ /* $NetBSD: lam.c,v 1.2 1994/11/14 20:27:42 jtc Exp $ */ /*- @@ -78,6 +78,10 @@ main(int argc, char *argv[]) getargs(argc, argv); if (numfiles == 0) usage(); + + if (pledge("stdio", NULL) == -1) + err(1, "pledge"); + /* Concatenate lines from each file, then print. */ for (;;) { linep = line; -- 2.20.1