From 6c036d4aa576416de7808e27a519c1c28aabb984 Mon Sep 17 00:00:00 2001 From: deraadt Date: Mon, 5 Oct 2015 15:16:23 +0000 Subject: If the -l flag is set, diff will fork/execve pr on a pipe. But other uses can tame "stdio wpath rpath cpath tmppath". tmppath for when mktemp() operates in /tmp proper, but cpath+wpath for use of $TMPDIR. ok sthen millert --- usr.bin/diff/diff.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'usr.bin/diff/diff.c') diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c index 743e9332f36..4b33cc6c40c 100644 --- a/usr.bin/diff/diff.c +++ b/usr.bin/diff/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.59 2015/04/29 04:00:25 deraadt Exp $ */ +/* $OpenBSD: diff.c,v 1.60 2015/10/05 15:16:23 deraadt Exp $ */ /* * Copyright (c) 2003 Todd C. Miller @@ -217,6 +217,10 @@ main(int argc, char **argv) argc -= optind; argv += optind; + if (lflag == 0) { + if (tame("stdio wpath rpath cpath tmppath", NULL) == -1) + err(1, "tame"); + } /* * Do sanity checks, fill in stb1 and stb2 and call the appropriate * driver routine. Both drivers use the contents of stb1 and stb2. -- cgit v1.2.3-59-g8ed1b