summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2012-09-02 21:05:42 (GMT)
committerVille Skyttä <ville.skytta@iki.fi>2012-09-02 21:05:42 (GMT)
commit90b4400c2ab2e80cecfd8dfdf031536376ed2cdb (patch)
tree70505e7c45cd78f0060e19205b1057bb69741af3
parent8635f08a69e51c090966d1825c8ac7de8fd6ab5b (diff)
downloadrpmdevtools-90b4400c2ab2e80cecfd8dfdf031536376ed2cdb.zip
rpmdevtools-90b4400c2ab2e80cecfd8dfdf031536376ed2cdb.tar.gz
rpmdevtools-90b4400c2ab2e80cecfd8dfdf031536376ed2cdb.tar.xz
Prevent symlink attack in annotate-output (#853452, CVE-2012-3500)
-rw-r--r--NEWS3
-rwxr-xr-xdevscripts/scripts/annotate-output.sh10
2 files changed, 10 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 5d50bd7..6a4109e 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,9 @@ rpmdevtools x.x (201x-xx-xx)
- Fix licensecheck to not truncate other licenses on Public domain
or WTFPL presence (#841043).
+ Jim Meyering:
+ - Prevent symlink attack in annotate-output (#853452, CVE-2012-3500).
+
rpmdevtools 8.2 (2011-11-12)
Ville Skyttä:
diff --git a/devscripts/scripts/annotate-output.sh b/devscripts/scripts/annotate-output.sh
index be0df3d..a1e1a31 100755
--- a/devscripts/scripts/annotate-output.sh
+++ b/devscripts/scripts/annotate-output.sh
@@ -62,10 +62,14 @@ if [ $# -lt 1 ]; then
exit 1
fi
-OUT=`mktemp --tmpdir annotate.XXXXXX` || exit 1
-ERR=`mktemp --tmpdir annotate.XXXXXX` || exit 1
+cleanup() { __st=$?; rm -rf "$tmp"; exit $__st; }
+trap cleanup 0
+trap 'exit $?' 1 2 13 15
+
+tmp=$(mktemp -d --tmpdir annotate.XXXXXX) || exit 1
+OUT=$tmp/out
+ERR=$tmp/err
-rm -f $OUT $ERR
mkfifo $OUT $ERR || exit 1
addtime O < $OUT &