diff options
author | kris <kris@FreeBSD.org> | 2000-11-02 06:33:57 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2000-11-02 06:33:57 +0000 |
commit | b721949a033185259c66fb20759afd7deb09631f (patch) | |
tree | 0adde804186775f428a401418a1d69b94749f91b /usr.sbin | |
parent | a472162cee4a4c7f269c597d81382d460d7e582e (diff) | |
download | FreeBSD-src-b721949a033185259c66fb20759afd7deb09631f.zip FreeBSD-src-b721949a033185259c66fb20759afd7deb09631f.tar.gz |
Don't use a trivially predictable temporary filename and keep recreating
it again and again, practically begging the Bad Man to insert his symlink
underneath it and send us down the path to oblivion.
Noticed by: David Lary <dlary@secureworks.net>
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/periodic/periodic.sh | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/periodic/periodic.sh b/usr.sbin/periodic/periodic.sh index cd152d8..ce38ba2 100644 --- a/usr.sbin/periodic/periodic.sh +++ b/usr.sbin/periodic/periodic.sh @@ -27,7 +27,7 @@ fi host=`hostname` export host -tmp_output=${TMPDIR:-/tmp}/periodic.$$ +tmp_output=`mktemp ${TMPDIR:-/tmp}/periodic.XXXXXXXXXX` # Execute each executable file in the directory list. If the x bit is not # set, assume the user didn't really want us to muck with it (it's a @@ -89,9 +89,10 @@ do esac [ $output = TRUE ] && { cat $tmp_output; empty=FALSE; } fi - rm -f $tmp_output + cp /dev/null $tmp_output fi done + rm -f $tmp_output done if [ $empty = TRUE ] then |