aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorGerd Moellmann2001-01-03 12:04:06 +0000
committerGerd Moellmann2001-01-03 12:04:06 +0000
commit38186d678fae2781c441c2e9273d97243647a7ad (patch)
treed6cc4c274a9f4fa7db981bb9ef82bd5f60a8663c /lib-src
parent04212fcbbd5616b5fb4c64b9ac35a8abca64cb40 (diff)
downloademacs-38186d678fae2781c441c2e9273d97243647a7ad.tar.gz
emacs-38186d678fae2781c441c2e9273d97243647a7ad.zip
Avoid security hole allowing attacker to
cause user of rcs2log to overwrite arbitrary files, fixing a bug reported by Morten Welinder. Don't put "exit 1" at the end of the exit trap; it's ineffective in POSIX shells.
Diffstat (limited to 'lib-src')
-rwxr-xr-xlib-src/rcs2log12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib-src/rcs2log b/lib-src/rcs2log
index f41552e110d..dd49a04f3c2 100755
--- a/lib-src/rcs2log
+++ b/lib-src/rcs2log
@@ -28,7 +28,7 @@ Options:
28 28
29Report bugs to <bug-gnu-emacs@gnu.org>.' 29Report bugs to <bug-gnu-emacs@gnu.org>.'
30 30
31Id='$Id: rcs2log,v 1.44 1998/08/12 14:22:14 eggert Exp eggert $' 31Id='$Id: rcs2log,v 1.46 2001/01/02 18:50:14 eggert Exp $'
32 32
33# Copyright 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. 33# Copyright 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
34 34
@@ -300,10 +300,12 @@ case $# in
300 esac 300 esac
301esac 301esac
302 302
303llogout=$TMPDIR/rcs2log$$l 303logdir=$TMPDIR/rcs2log$$
304rlogout=$TMPDIR/rcs2log$$r 304llogout=$logdir/l
305rlogout=$logdir/r
305trap exit 1 2 13 15 306trap exit 1 2 13 15
306trap "rm -f $llogout $rlogout; exit 1" 0 307trap "rm -fr $logdir 2>/dev/null" 0
308(umask 077 && exec mkdir $logdir) || exit
307 309
308case $datearg in 310case $datearg in
309?*) $rlog $rlog_options "$datearg" ${1+"$@"} >$rlogout;; 311?*) $rlog $rlog_options "$datearg" ${1+"$@"} >$rlogout;;
@@ -670,7 +672,7 @@ $AWK '
670 672
671# Exit successfully. 673# Exit successfully.
672 674
673exec rm -f $llogout $rlogout 675exec rm -fr $logdir
674 676
675# Local Variables: 677# Local Variables:
676# tab-width:4 678# tab-width:4