From 043be552c87936fd38bcba7b5ff61041311a8a2f Mon Sep 17 00:00:00 2001 From: deraadt Date: Thu, 8 Oct 2015 04:39:24 +0000 Subject: [PATCH] Try again. Both -R and -p prevent use of tame, but other cases can use it. --- bin/cp/cp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/cp/cp.c b/bin/cp/cp.c index 2f6f7804117..e62dbb3b9e1 100644 --- a/bin/cp/cp.c +++ b/bin/cp/cp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cp.c,v 1.40 2015/10/08 00:07:20 deraadt Exp $ */ +/* $OpenBSD: cp.c,v 1.41 2015/10/08 04:39:24 deraadt Exp $ */ /* $NetBSD: cp.c,v 1.14 1995/09/07 06:14:51 jtc Exp $ */ /* @@ -129,6 +129,14 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; + /* + * Unfortunately, -R will use mkfifo & mknod; + * -p will use fchown, fchmod, lchown, fchflags.. + */ + if (Rflag == 0 && pflag == 0) + if (tame("stdio rpath wpath cpath fattr", NULL) == -1) + err(1, "tame"); + if (argc < 2) usage(); -- 2.20.1