summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Mestre <mestre@cvs.openbsd.org>2019-11-30 14:02:48 +0000
committerRicardo Mestre <mestre@cvs.openbsd.org>2019-11-30 14:02:48 +0000
commite666e390b68716c1c314f8cecf1a02bd79ac86f4 (patch)
tree0e674dd4b5f7b27b48b4da3b1f1d41431c90b7b8
parentd4a7de6a1affd1eaf8ee443b753e11bfb376b8e7 (diff)
unveil(2) /dev with read permissions since it's the only directory usbdevs(8)
will read from OK kn@
-rw-r--r--usr.sbin/usbdevs/usbdevs.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/usbdevs/usbdevs.c b/usr.sbin/usbdevs/usbdevs.c
index d41e7ad868a..165f668b527 100644
--- a/usr.sbin/usbdevs/usbdevs.c
+++ b/usr.sbin/usbdevs/usbdevs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usbdevs.c,v 1.31 2019/04/14 18:16:19 deraadt Exp $ */
+/* $OpenBSD: usbdevs.c,v 1.32 2019/11/30 14:02:47 mestre Exp $ */
/* $NetBSD: usbdevs.c,v 1.19 2002/02/21 00:34:31 christos Exp $ */
/*
@@ -267,6 +267,11 @@ main(int argc, char **argv)
if (argc != 0)
usage();
+ if (unveil("/dev", "r") == -1)
+ err(1, "unveil");
+ if (unveil(NULL, NULL) == -1)
+ err(1, "unveil");
+
if (dev == 0) {
for (ncont = 0, i = 0; i < 10; i++) {
snprintf(buf, sizeof buf, "%s%d", USBDEV, i);