Fix insecure tempfile creation in ps2epsi and pv.sh.

http://marc.theaimsgroup.com/?l=bugtraq&m=109655739113230&w=2
This commit is contained in:
brad 2004-10-24 21:53:02 +00:00
parent 6a792cd6da
commit 2c174a00d2
3 changed files with 31 additions and 1 deletions

View File

@ -1,9 +1,10 @@
# $OpenBSD: Makefile,v 1.24 2004/09/15 18:32:14 espie Exp $
# $OpenBSD: Makefile,v 1.25 2004/10/24 21:53:02 brad Exp $
COMMENT= "AFPL PostScript interpreter"
VERSION= 8.14
DISTNAME= ghostscript-${VERSION}
PKGNAME= ${DISTNAME}p1
CATEGORIES= print lang
DIR= AFPL/gs${VERSION:S/.//}

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-lib_ps2epsi,v 1.1 2004/10/24 21:53:02 brad Exp $
--- lib/ps2epsi.orig Sun Oct 24 17:48:10 2004
+++ lib/ps2epsi Sun Oct 24 17:48:32 2004
@@ -1,7 +1,7 @@
#!/bin/sh
# $Id: patch-lib_ps2epsi,v 1.1 2004/10/24 21:53:02 brad Exp $
-tmpfile=/tmp/ps2epsi$$
+tmpfile=`mktemp -t ps2epsiXXXXXXXXXX` || exit 1
export outfile

View File

@ -0,0 +1,17 @@
$OpenBSD: patch-lib_pv_sh,v 1.1 2004/10/24 21:53:02 brad Exp $
--- lib/pv.sh.orig Thu Feb 21 16:49:28 2002
+++ lib/pv.sh Sun Oct 24 17:49:36 2004
@@ -29,9 +29,10 @@ TEMPDIR=.
PAGE=$1
shift
FILE=$1
+TEMPFILE=`mktemp -t ${FILE}XXXXXXXXXX` || exit 1
shift
-trap "rm -rf $TEMPDIR/$FILE.$$.pv" 0 1 2 15
+trap "rm -rf $TEMPFILE" 0 1 2 15
#dvips -D$RESOLUTION -p $PAGE -n 1 $FILE $* -o $FILE.$$.pv
-dvips -p $PAGE -n 1 $FILE $* -o $FILE.$$.pv
-gs $FILE.$$.pv
+dvips -p $PAGE -n 1 $FILE $* -o $TEMPFILE
+gs $TEMPFILE
exit 0