Merge pull request #320 from fewtarius/dev
Correct set_setting to ignore bad data passed as a key.
This commit is contained in:
commit
feb1a2f877
1 changed files with 2 additions and 5 deletions
|
@ -41,12 +41,9 @@ get_setting() {
|
|||
}
|
||||
|
||||
set_setting() {
|
||||
if [ "$2" == "disable" ]
|
||||
if [[ "${1}" =~ ^[[:alnum:]] ]]
|
||||
then
|
||||
sed -i "/^#$1=/d" "${J_CONF}"
|
||||
echo "#${1}=" >> "${J_CONF}"
|
||||
else
|
||||
sed -i "/^$1=/d" "${J_CONF}"
|
||||
sed -i "/^${1}=/d" "${J_CONF}"
|
||||
echo "${1}=${2}" >> "${J_CONF}"
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue