summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoug <doug@openbsd.org>2015-10-11 19:00:40 +0000
committerdoug <doug@openbsd.org>2015-10-11 19:00:40 +0000
commitfdcd7891d1da154565cf85f7e8c1e3ab7bd22c99 (patch)
tree7305e62ec900158eeca13555637a287824de0cc7
parentMention that the first argument of .Pf does not need escaping. (diff)
downloadwireguard-openbsd-fdcd7891d1da154565cf85f7e8c1e3ab7bd22c99.tar.xz
wireguard-openbsd-fdcd7891d1da154565cf85f7e8c1e3ab7bd22c99.zip
Pledge that ncheck_ffs only uses "stdio" after opening the device.
ok deraadt@
-rw-r--r--sbin/ncheck_ffs/ncheck_ffs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sbin/ncheck_ffs/ncheck_ffs.c b/sbin/ncheck_ffs/ncheck_ffs.c
index 46b7d2cd2d8..e299eb767da 100644
--- a/sbin/ncheck_ffs/ncheck_ffs.c
+++ b/sbin/ncheck_ffs/ncheck_ffs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ncheck_ffs.c,v 1.50 2015/02/07 02:09:13 deraadt Exp $ */
+/* $OpenBSD: ncheck_ffs.c,v 1.51 2015/10/11 19:00:40 doug Exp $ */
/*-
* Copyright (c) 1995, 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
@@ -590,6 +590,10 @@ gotdev:
err(1, "ioctl (DIOCGDINFO)");
if (ioctl(diskfd, DIOCGPDINFO, (char *)&lab) < 0)
err(1, "ioctl (DIOCGPDINFO)");
+
+ if (pledge("stdio", NULL) == -1)
+ err(1, "pledge");
+
sblock = (struct fs *)sblock_buf;
for (i = 0; sblock_try[i] != -1; i++) {
n = pread(diskfd, sblock, SBLOCKSIZE, (off_t)sblock_try[i]);