Fix potentional security issue. Thanks to Javier Fernández-Sanguino Peña <jfs@computer.org>

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@3060 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Rudolf Marek committed 2005-08-20 19:45:53 +00:00
1 parent ab86f9c284
commit 8894546f1f
1 file changed
+5 -3
+5 -3
View File
@@ -465,9 +465,11 @@ function TestMinStop {
function SaveConfig {
echo
echo "Saving configuration to $FCCONFIG..."
egrep -v '(INTERVAL|FCTEMPS|FCFANS|MAXTEMP|MINTEMP|MINSTART|MINSTOP)' $FCCONFIG >/tmp/fancontrol
echo -e "INTERVAL=$INTERVAL\nFCTEMPS=$FCTEMPS\nFCFANS=$FCFANS\nMINTEMP=$MINTEMP\nMAXTEMP=$MAXTEMP\nMINSTART=$MINSTART\nMINSTOP=$MINSTOP" >>/tmp/fancontrol
mv /tmp/fancontrol $FCCONFIG
tmpfile=`tempfile` || { echo "$0: Cannot create temporary file" >&2; exit 1; }
trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15
egrep -v '(INTERVAL|FCTEMPS|FCFANS|MAXTEMP|MINTEMP|MINSTART|MINSTOP)' $FCCONFIG >$tmpfile
echo -e "INTERVAL=$INTERVAL\nFCTEMPS=$FCTEMPS\nFCFANS=$FCFANS\nMINTEMP=$MINTEMP\nMAXTEMP=$MAXTEMP\nMINSTART=$MINSTART\nMINSTOP=$MINSTOP" >>$tmpfile
mv $tmpfile $FCCONFIG
#check if file was written correctly
echo 'Configuration saved'
}