File groff-1.20.1-CVE-2009-5044.patch of Package gxditview.import4718

Index: groff-1.20.1/contrib/pdfmark/pdfroff.sh
===================================================================
--- groff-1.20.1.orig/contrib/pdfmark/pdfroff.sh	2011-06-09 10:41:29.000000000 +0200
+++ groff-1.20.1/contrib/pdfmark/pdfroff.sh	2011-06-09 10:54:58.208448083 +0200
@@ -145,14 +145,16 @@
 
   GROFF_TMPDIR=${WRKDIR}
 
-  WRKFILE=${GROFF_TMPDIR}/pdf$$.tmp
+  WRKFILE=`mktemp --tmpdir="${GROFF_TMPDIR}" pdfXXXXXXXXXX.tmp`
 #
-  REFCOPY=${GROFF_TMPDIR}/pdf$$.cmp
-  REFFILE=${GROFF_TMPDIR}/pdf$$.ref
+  REFCOPY=`mktemp --tmpdir="${GROFF_TMPDIR}" pdfXXXXXXXXXX.cmp`
+  REFFILE=`mktemp --tmpdir="${GROFF_TMPDIR}" pdfXXXXXXXXXX.ref`
 #
   CS_DATA=""
-  TC_DATA=${GROFF_TMPDIR}/pdf$$.tc
-  BD_DATA=${GROFF_TMPDIR}/pdf$$.ps
+  TC_DATA=`mktemp --tmpdir="${GROFF_TMPDIR}" pdfXXXXXXXXXX.tc`
+  BD_DATA=`mktemp --tmpdir="${GROFF_TMPDIR}" pdfXXXXXXXXXX.ps`
+
+  STREAMFILE=`mktemp --tmpdir="${GROFF_TMPDIR}" pdfXXXXXXXXXX.in`
 #
 # Initialise 'groff' format control settings,
 # to discriminate table of contents and document body formatting passes.
@@ -305,7 +307,7 @@
                ;;
 
              --stylesheet)
-               STYLESHEET="$OPTARG" CS_DATA=${GROFF_TMPDIR}/pdf$$.cs
+               STYLESHEET="$OPTARG" CS_DATA=`mktemp --tmpdir="${GROFF_TMPDIR}" pdfXXXXXXXXXX.cs`
                ;;
 
 	     --no-toc-relocation)
@@ -338,7 +340,7 @@
 #     so set up a mechanism to achieve this, for ALL 'groff' passes.
 #
       - | -i*)
-	   STREAM="$CAT ${GROFF_TMPDIR}/pdf$$.in |"
+	   STREAM="$CAT ${STREAMFILE} |"
 	   test "$1" = "-" && INPUT_FILES="$INPUT_FILES $1" \
 	     || GROFF_STYLE="$GROFF_STYLE $1" 
 	   ;;
@@ -410,8 +412,8 @@
 # or if no input files are specified, then we need to capture STDIN,
 # so we can replay it into each 'groff' processing pass.
 #
-  test -z "$INPUT_FILES" && STREAM="$CAT ${GROFF_TMPDIR}/pdf$$.in |"
-  test -n "$STREAM" && $CAT > ${GROFF_TMPDIR}/pdf$$.in
+  test -z "$INPUT_FILES" && STREAM="$CAT ${STREAMFILE} |"
+  test -n "$STREAM" && $CAT > ${STREAMFILE}
 #
 # Unless reference resolution is explicitly suppressed,
 # we initiate it by touching the cross reference dictionary file,