1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-27 05:10:36 +00:00
freebsd-ports/comms/mgetty+sendfax/files/patch-CVE-2008-4936
2015-12-11 00:25:36 +00:00

53 lines
1.3 KiB
Plaintext

--- fax/faxspool.in.orig 2010-06-04 13:01:49 UTC
+++ fax/faxspool.in
@@ -672,12 +672,12 @@ fi
#
# mkdir a directory in $TMP (or /tmp), convert input to G3 in there
#
-spooldir=${TMP:-/tmp}/$new_seq.$$.`date +%S`
+spooldir=`mktemp -d "${TMP:-/tmp}"/"$new_seq.$$".XXXXXXXX`
-if ( umask 077 ; mkdir $spooldir ) ; then
+if [ $? -eq 0 ]; then
$echo "spooling to $spooldir (->$new_seq)..."
else
- $echo "ERROR: can't create work dir '$spooldir', giving up" >&2 ; exit 6
+ $echo "ERROR: can't create work dir inside '${TMP:-/tmp}', giving up" >&2 ; exit 6
fi
#
@@ -694,9 +694,12 @@ do
if [ x$file = x- ]
then
$echo "spooling $file (stdin)..."
- trap "rm /tmp/faxsp.$$" 0
- cat - >/tmp/faxsp.$$
- file=/tmp/faxsp.$$
+ file=`mktemp "$spooldir/faxsp.XXXXXXXX"`
+ if [ -z "$file" ]; then
+ $echo "ERROR: can't create work file, giving up" >&2; exit 6
+ fi
+ trap "rm -f $file" 0
+ cat - >"$file"
else
$echo "spooling $file..."
fi
@@ -951,7 +954,7 @@ if [ -z "$finalpg" -a -z "$poll_req" ]
then
$echo "\nnothing to do (no cover page, no data)." >&2
cd $FAX_SPOOL_OUT
- rmdir $spooldir
+ rm -rf $spooldir
exit 52
fi
@@ -992,7 +995,7 @@ $FAXQ_HELPER activate $new_seq < $job.q
# clean up
rm $job.q
cd ..
-rmdir $spooldir
+rm -rf $spooldir
if [ -z "`find $LAST_RUN -ctime -1 -print 2>/dev/null`" ]
then