]> git.pld-linux.org Git - packages/lm_sensors.git/blob - lm_sensors-CAN-2005-2672.patch
- fix for CAN-2005-2672 (insecure temporary file creation)
[packages/lm_sensors.git] / lm_sensors-CAN-2005-2672.patch
1 diff -burN lm_sensors-2.9.1.orig/prog/pwm/pwmconfig lm_sensors-2.9.1/prog/pwm/pwmconfig
2 --- lm_sensors-2.9.1.orig/prog/pwm/pwmconfig    2005-08-31 09:38:08.272485088 +0200
3 +++ lm_sensors-2.9.1/prog/pwm/pwmconfig 2005-08-31 09:40:43.701856232 +0200
4 @@ -465,9 +465,11 @@
5  function SaveConfig {
6         echo
7         echo "Saving configuration to $FCCONFIG..."
8 -       egrep -v '(INTERVAL|FCTEMPS|FCFANS|MAXTEMP|MINTEMP|MINSTART|MINSTOP)' $FCCONFIG >/tmp/fancontrol
9 -       echo -e "INTERVAL=$INTERVAL\nFCTEMPS=$FCTEMPS\nFCFANS=$FCFANS\nMINTEMP=$MINTEMP\nMAXTEMP=$MAXTEMP\nMINSTART=$MINSTART\nMINSTOP=$MINSTOP" >>/tmp/fancontrol
10 -       mv /tmp/fancontrol $FCCONFIG
11 +       tmpfile=`mktemp pwmconfig.XXXXXX` || { echo "$0: Cannot create temporary file" >&2; exit 1;  }
12 +       trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15
13 +       egrep -v '(INTERVAL|FCTEMPS|FCFANS|MAXTEMP|MINTEMP|MINSTART|MINSTOP)' $FCCONFIG >$tmpfile
14 +       echo -e "INTERVAL=$INTERVAL\nFCTEMPS=$FCTEMPS\nFCFANS=$FCFANS\nMINTEMP=$MINTEMP\nMAXTEMP=$MAXTEMP\nMINSTART=$MINSTART\nMINSTOP=$MINSTOP" >>$tmpfile
15 +       mv $tmpfile $FCCONFIG
16         #check if file was written correctly
17         echo 'Configuration saved'
18  }
This page took 0.056162 seconds and 4 git commands to generate.