Blame SOURCES/0003-various-security-fixes.patch

706f28
From f95bed4ad636f286ef9ff3f5b4330a10938fd064 Mon Sep 17 00:00:00 2001
706f28
From: Jan Vcelak <jvcelak@redhat.com>
706f28
Date: Tue, 4 Nov 2014 14:36:47 +0100
706f28
Subject: [PATCH 3/4] various security fixes
706f28
706f28
CVE-2009-5044 (#709413)
706f28
CVE-2009-5080 (#720058)
706f28
CVE-2009-5081 (#720057)
706f28
706f28
Based on: http://cvsweb.openwall.com/cgi/cvsweb.cgi/Owl/packages/groff/groff-1.20.1-owl-tmp.diff?rev=1.2;content-    type=text%2Fplain
706f28
Resolves: #709415, #720060
706f28
Signed-off-by: Jan Vcelak <jvcelak@redhat.com>
706f28
---
706f28
 contrib/eqn2graph/eqn2graph.sh    |  2 ++
706f28
 contrib/gdiffmk/tests/runtests.sh |  5 +++--
706f28
 contrib/grap2graph/grap2graph.sh  |  2 ++
706f28
 contrib/groffer/main_subs.pl      | 10 +++++-----
706f28
 contrib/groffer/roff2.pl          |  2 +-
706f28
 contrib/pdfmark/pdfroff.1.man     |  5 +++--
706f28
 contrib/pic2graph/pic2graph.sh    |  2 ++
706f28
 doc/fixinfo.sh                    |  5 +++--
706f28
 doc/groff.texi                    |  6 +++---
706f28
 gendef.sh                         | 10 +++-------
706f28
 10 files changed, 27 insertions(+), 22 deletions(-)
706f28
706f28
diff --git a/contrib/eqn2graph/eqn2graph.sh b/contrib/eqn2graph/eqn2graph.sh
706f28
index 3e9c374..4e4f11e 100644
706f28
--- a/contrib/eqn2graph/eqn2graph.sh
706f28
+++ b/contrib/eqn2graph/eqn2graph.sh
706f28
@@ -74,6 +74,8 @@ then
706f28
     # but is supported by the stripped-down dash shell, for instance.
706f28
     tmp="$d/eqn2graph$$-${RANDOM:-$PPID}"
706f28
     (umask 077 && mkdir "$tmp") 2> /dev/null
706f28
+
706f28
+    tmp=
706f28
 fi
706f28
 
706f28
 if ! test -d "$tmp"
706f28
diff --git a/contrib/gdiffmk/tests/runtests.sh b/contrib/gdiffmk/tests/runtests.sh
706f28
index 0f7c3b6..f8aa874 100755
706f28
--- a/contrib/gdiffmk/tests/runtests.sh
706f28
+++ b/contrib/gdiffmk/tests/runtests.sh
706f28
@@ -63,8 +63,9 @@ TestResult () {
706f28
 	fi
706f28
 }
706f28
 
706f28
-tmpfile=/tmp/$$
706f28
-trap 'rm -f ${tmpfile}' 0 1 2 3 15
706f28
+tmpfile="`mktemp -t gdiffmk-runtests.XXXXXXXXXX`" || exit
706f28
+trap 'rm -f -- "$tmpfile"' EXIT
706f28
+trap 'trap - EXIT; rm -f -- "$tmpfile"; exit 1' HUP INT QUIT TERM
706f28
 
706f28
 #	Run tests.
706f28
 
706f28
diff --git a/contrib/grap2graph/grap2graph.sh b/contrib/grap2graph/grap2graph.sh
706f28
index 29df25b..94c436b 100644
706f28
--- a/contrib/grap2graph/grap2graph.sh
706f28
+++ b/contrib/grap2graph/grap2graph.sh
706f28
@@ -76,6 +76,8 @@ then
706f28
     # but is supported by the stripped-down dash shell, for instance.
706f28
     tmp="$d/grap2graph$$-${RANDOM:-$PPID}"
706f28
     (umask 077 && mkdir "$tmp") 2> /dev/null
706f28
+
706f28
+    tmp=
706f28
 fi
706f28
 
706f28
 if ! test -d "$tmp"
706f28
diff --git a/contrib/groffer/main_subs.pl b/contrib/groffer/main_subs.pl
706f28
index a40e356..c8c4e53 100644
706f28
--- a/contrib/groffer/main_subs.pl
706f28
+++ b/contrib/groffer/main_subs.pl
706f28
@@ -1244,7 +1244,7 @@ sub main_temp {
706f28
   our $fh_stdin;
706f28
   our $tmp_cat;
706f28
   our $tmp_stdin;
706f28
-  my $template = 'groffer_' . "$$" . '_XXXX';
706f28
+  my $template = 'groffer_' . "$$" . '_XXXXXXXXXX';
706f28
   foreach ($ENV{'GROFF_TMPDIR'}, $ENV{'TMPDIR'}, $ENV{'TMP'}, $ENV{'TEMP'},
706f28
 	   $ENV{'TEMPDIR'}, File::Spec->catfile($ENV{'HOME'}, 'tmp')) {
706f28
     if ($_ && -d $_ && -w $_) {
706f28
@@ -1276,12 +1276,12 @@ sub main_temp {
706f28
 
706f28
   # further argument: SUFFIX => '.sh'
706f28
   if ($Debug{'KEEP'}) {
706f28
-    ($fh_cat, $tmp_cat) = tempfile(',cat_XXXX', DIR => $tmpdir);
706f28
-    ($fh_stdin, $tmp_stdin) = tempfile(',stdin_XXXX', DIR => $tmpdir);
706f28
+    ($fh_cat, $tmp_cat) = tempfile(',cat_XXXXXXXXXX', DIR => $tmpdir);
706f28
+    ($fh_stdin, $tmp_stdin) = tempfile(',stdin_XXXXXXXXXX', DIR => $tmpdir);
706f28
   } else {
706f28
-    ($fh_cat, $tmp_cat) = tempfile(',cat_XXXX', UNLINK => 1,
706f28
+    ($fh_cat, $tmp_cat) = tempfile(',cat_XXXXXXXXXX', UNLINK => 1,
706f28
 				   DIR => $tmpdir);
706f28
-    ($fh_stdin, $tmp_stdin) = tempfile(',stdin_XXXX', UNLINK => 1,
706f28
+    ($fh_stdin, $tmp_stdin) = tempfile(',stdin_XXXXXXXXXX', UNLINK => 1,
706f28
 				       DIR => $tmpdir);
706f28
   }
706f28
 }				# main_temp()
706f28
diff --git a/contrib/groffer/roff2.pl b/contrib/groffer/roff2.pl
706f28
index cf5c583..24af006 100755
706f28
--- a/contrib/groffer/roff2.pl
706f28
+++ b/contrib/groffer/roff2.pl
706f28
@@ -123,7 +123,7 @@ if ($Has_Groffer) {
706f28
 	last;
706f28
       }
706f28
     }
706f28
-    my $template = $Name . '_XXXX';
706f28
+    my $template = $Name . '_XXXXXXXXXX';
706f28
     my ($fh, $stdin);
706f28
     if ($tempdir) {
706f28
       ($fh, $stdin) = tempfile($template, UNLINK => 1, DIR => $tempdir) ||
706f28
diff --git a/contrib/pdfmark/pdfroff.1.man b/contrib/pdfmark/pdfroff.1.man
706f28
index 95d7807..aa6f079 100644
706f28
--- a/contrib/pdfmark/pdfroff.1.man
706f28
+++ b/contrib/pdfmark/pdfroff.1.man
706f28
@@ -540,7 +540,7 @@ gs \-dBATCH \-dQUIET \-dNOPAUSE \-dSAFER \-sDEVICE=pdfwrite \e
706f28
 .I GROFF_TMPDIR
706f28
 Identifies the directory in which
706f28
 .B pdfroff
706f28
-should create temporary files.
706f28
+should create a subdirectory for its temporary files.
706f28
 .
706f28
 If
706f28
 .I \%GROFF_TMPDIR
706f28
@@ -553,7 +553,8 @@ and
706f28
 .I TEMP
706f28
 are considered in turn, as possible temporary file repositories.
706f28
 If none of these are set, then temporary files are created
706f28
-in the current directory.
706f28
+in a subdirectory of
706f28
+.BR /tmp .
706f28
 .
706f28
 .TP
706f28
 .I GROFF_GHOSTSCRIPT_INTERPRETER
706f28
diff --git a/contrib/pic2graph/pic2graph.sh b/contrib/pic2graph/pic2graph.sh
706f28
index b229914..2d6e77c 100644
706f28
--- a/contrib/pic2graph/pic2graph.sh
706f28
+++ b/contrib/pic2graph/pic2graph.sh
706f28
@@ -89,6 +89,8 @@ then
706f28
     # but is supported by the stripped-down dash shell, for instance.
706f28
     tmp="$d/pic2graph$$-${RANDOM:-$PPID}"
706f28
     (umask 077 && mkdir "$tmp") 2> /dev/null
706f28
+
706f28
+    tmp=
706f28
 fi
706f28
 
706f28
 if ! test -d "$tmp"
706f28
diff --git a/doc/fixinfo.sh b/doc/fixinfo.sh
706f28
index 47127f8..69bb74d 100644
706f28
--- a/doc/fixinfo.sh
706f28
+++ b/doc/fixinfo.sh
706f28
@@ -24,8 +24,9 @@
706f28
 #
706f28
 # 09-2014: no more problem with texinfo 5.0 or higher
706f28
 #
706f28
-t=${TMPDIR-.}/gro$$.tmp
706f28
-
706f28
+t="`mktemp -t groff-fixinfo.XXXXXXXXXX`" || exit
706f28
+trap 'rm -f -- "$t"' EXIT
706f28
+trap 'trap - EXIT; rm -f -- "$t"; exit 1' HUP INT QUIT TERM
706f28
 cat $1 | sed '
706f28
 1 {
706f28
   N
706f28
diff --git a/doc/groff.texi b/doc/groff.texi
706f28
index e7fe4aa..b4d01ed 100644
706f28
--- a/doc/groff.texi
706f28
+++ b/doc/groff.texi
706f28
@@ -13857,9 +13857,9 @@ into a document:
706f28
 @pindex perl
706f28
 @Example
706f28
 .sy perl -e 'printf ".nr H %d\\n.nr M %d\\n.nr S %d\\n",\
706f28
-             (localtime(time))[2,1,0]' > /tmp/x\n[$$]
706f28
-.so /tmp/x\n[$$]
706f28
-.sy rm /tmp/x\n[$$]
706f28
+             (localtime(time))[2,1,0]' > timefile\n[$$]
706f28
+.so timefile\n[$$]
706f28
+.sy rm timefile\n[$$]
706f28
 \nH:\nM:\nS
706f28
 @endExample
706f28
 
706f28
diff --git a/gendef.sh b/gendef.sh
706f28
index be41dbe..4770bae 100644
706f28
--- a/gendef.sh
706f28
+++ b/gendef.sh
706f28
@@ -33,11 +33,9 @@ do
706f28
 #define $def"
706f28
 done
706f28
 
706f28
-# Use $TMPDIR if defined.  Default to cwd, for non-Unix systems
706f28
-# which don't have /tmp on each drive (we are going to remove
706f28
-# the file before we exit anyway).  Put the PID in the basename,
706f28
-# since the extension can only hold 3 characters on MS-DOS.
706f28
-t=${TMPDIR-.}/gro$$.tmp
706f28
+t="`mktemp -t groff-gendef.XXXXXXXXXX`" || exit
706f28
+trap 'rm -f -- "$t"' EXIT
706f28
+trap 'trap - EXIT; rm -f -- "$t"; exit 1' HUP INT QUIT TERM
706f28
 
706f28
 sed -e 's/=/ /' >$t <
706f28
 $defs
706f28
@@ -45,8 +43,6 @@ EOF
706f28
 
706f28
 test -r $file && cmp -s $t $file || cp $t $file
706f28
 
706f28
-rm -f $t
706f28
-
706f28
 exit 0
706f28
 
706f28
 # eof
706f28
-- 
706f28
2.21.1
706f28