summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2018-07-11 11:42:17 +0000
committerschwarze <schwarze@openbsd.org>2018-07-11 11:42:17 +0000
commit5117cd2872e582a1233cdfaea7760eb050235d5c (patch)
treecf4ec52a6bbc76fab66d0251464ad43e829d1d8b
parentthe STATE_LOOKUP macro made sense ages ago. It stopped making sense (diff)
downloadwireguard-openbsd-5117cd2872e582a1233cdfaea7760eb050235d5c.tar.xz
wireguard-openbsd-5117cd2872e582a1233cdfaea7760eb050235d5c.zip
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@
-rw-r--r--usr.bin/lam/lam.c6
1 files changed, 5 insertions, 1 deletions
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;