summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorSebastien Marie <semarie@cvs.openbsd.org>2015-09-28 15:40:19 +0000
committerSebastien Marie <semarie@cvs.openbsd.org>2015-09-28 15:40:19 +0000
commitca3e975222c42bf7d4ac9f4fd3fdccd37deff133 (patch)
tree8dec86e740aa3286a35d710e54d369ae658fc9aa /sys/kern
parent57187f60207da9f4df32f94dcc40a5523c250188 (diff)
make using tame path "/" work.
and add a regress test for that. ok deraadt@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_tame.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/kern_tame.c b/sys/kern/kern_tame.c
index bdce41a5d9e..3ed3ff74661 100644
--- a/sys/kern/kern_tame.c
+++ b/sys/kern/kern_tame.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_tame.c,v 1.42 2015/09/19 20:39:06 semarie Exp $ */
+/* $OpenBSD: kern_tame.c,v 1.43 2015/09/28 15:40:18 semarie Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
@@ -626,7 +626,8 @@ tame_namei(struct proc *p, char *origpath)
wl->wl_paths[i].len - 1) == 0) {
u_char term = canopath[wl->wl_paths[i].len - 1];
- if (term == '\0' || term == '/')
+ if (term == '\0' || term == '/' ||
+ wl->wl_paths[i].name[1] == '\0')
error = 0;
}
}