diff options
author | Ricardo Mestre <mestre@cvs.openbsd.org> | 2018-10-26 17:11:33 +0000 |
---|---|---|
committer | Ricardo Mestre <mestre@cvs.openbsd.org> | 2018-10-26 17:11:33 +0000 |
commit | 57f6e4f2e591c0f8754d1766e9d9b5528916d8e6 (patch) | |
tree | 92287cb5ce3954569d206023a4d5c9eeaebafa78 | |
parent | 1f539aaea74ffac1e5e307c1c1077fa92300e5cc (diff) |
The code path were we pass `pathname' in the arguments is already limited
with pledge(2), but since we know exactly what it is then we can go further and
also unveil(2) it with read permissions.
OK millert@ deraadt@
-rw-r--r-- | usr.bin/getconf/getconf.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/getconf/getconf.c b/usr.bin/getconf/getconf.c index f4706145468..3cf332f1181 100644 --- a/usr.bin/getconf/getconf.c +++ b/usr.bin/getconf/getconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getconf.c,v 1.19 2016/10/28 07:22:59 schwarze Exp $ */ +/* $OpenBSD: getconf.c,v 1.20 2018/10/26 17:11:32 mestre Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -513,6 +513,8 @@ main(int argc, char *argv[]) break; case PATHCONF: + if (unveil(argv[1], "r") == -1) + err(1, "unveil"); if (pledge("stdio rpath", NULL) == -1) err(1, "pledge"); errno = 0; |