#! /bin/sh /usr/share/dpatch/dpatch-run ## 10_fix_insecure_tmp.dpatch by Thijs Kinkhorst ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: fix insecure temp file usage @DPATCH@ diff -Nur myspell-3.0+pre3.1.orig/utils/i2myspell myspell-3.0+pre3.1/utils/i2myspell --- myspell-3.0+pre3.1.orig/utils/i2myspell 2002-03-08 15:15:53.000000000 +0100 +++ myspell-3.0+pre3.1/utils/i2myspell 2008-08-26 15:14:45.000000000 +0200 @@ -32,6 +32,7 @@ -d) # dict file uniq +TEMPFILE1=`mktemp -t i2my1.XXXXXXXXXX` sed 's#/# #' $2 | sort -r -k 1 | uniq | grep -v ^$ | awk '{ if (p!=$1) { @@ -41,16 +42,18 @@ if ($2!="") printf "/%s", $2; } }' | sed 's#/##g -s# #/#' >/tmp/i2my$$.1 -cat /tmp/i2my$$.1 | wc -l | tr -cd '0-9\n' -tail +2 /tmp/i2my$$.1 +s# #/#' >$TEMPFILE1 +cat $TEMPFILE1 | wc -l | tr -cd '0-9\n' +tail +2 $TEMPFILE1 echo -rm -f /tmp/i2my$$.1 +rm -f $TEMPFILE1 exit;; esac ispell -d $1 -D | # dump affix table from the ispell hash +TEMPFILE1=`mktemp -t i2my1.XXXXXXXXXX` +TEMPFILE2=`mktemp -t i2my2.XXXXXXXXXX` sed 's/ //g /prefixes/,/suffixes/s/flag[*]\(.\):/PFX \1 Y / /prefixes/,/suffixes/s/flag\(.\):/PFX \1 N / @@ -58,7 +61,7 @@ /suffixes/,//s/flag\(.\):/SFX \1 N / s/\([^ ]*\).>.\([^,]*\)$/0 \2 \1/ s/\([^ ]*\).>.-\([^,]*\),\(.*\)$/\2 \3 \1/' | -tee /tmp/i2my$$.1 | cut -c -7 > /tmp/i2my$$.2 +tee $TEMPFILE1 | cut -c -7 > $TEMPFILE2 # myspell affix table header echo "SET $2" @@ -66,9 +69,9 @@ if [ -n "$7" ]; then echo "COMPOUNDMIN $7"; fi; if [ -n "$6" ]; then echo "COMPOUNDFLAG $6"; fi; -cut -c 8- /tmp/i2my$$.1 | +cut -c 8- $TEMPFILE1 | tr $3 $4 | -paste -d "" /tmp/i2my$$.2 - | +paste -d "" $TEMPFILE2 - | egrep -v '^(suffixes|prefixes|flagmarker)' | sort -k 2 | awk ' NR==1 { o1=$1; o2=$2; o3=$3; n[o2]=-1; } @@ -83,4 +86,4 @@ } END { printf "%s %s %s %s\n", o1, o2, o3, n[o2]+1; } ' | tee x | sed 's/ *$//' | sort -r | sed 's/\(^.*[0-9]\)$/\ \1/' -rm /tmp/i2my$$.* +rm $TEMPFILE1 $TEMPFILE2