From 869edd8e6abb6dae1fd51dcdbd97e7f9254a3145 Mon Sep 17 00:00:00 2001 From: jh Date: Sat, 13 Mar 2010 12:02:44 +0000 Subject: Use an unique directory name instead of hardcoded /tmp/.diskless. A malicious user could create a file named /tmp/.diskless and cause the script to misbehave. PR: conf/141258 Reported by: Jon Passki MFC after: 1 week --- etc/rc.d/tmp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'etc') diff --git a/etc/rc.d/tmp b/etc/rc.d/tmp index abf53ac..282709e 100755 --- a/etc/rc.d/tmp +++ b/etc/rc.d/tmp @@ -51,8 +51,8 @@ case "${tmpmfs}" in [Nn][Oo]) ;; *) - if /bin/mkdir -p /tmp/.diskless 2> /dev/null; then - rmdir /tmp/.diskless + if _tmpdir=$(mktemp -d -q /tmp/.diskless.XXXXXX); then + rmdir ${_tmpdir} else if [ -h /tmp ]; then echo "*** /tmp is a symlink to a non-writable area!" -- cgit v1.1