Merge pull request #320 from fewtarius/dev

Correct set_setting to ignore bad data passed as a key.
This commit is contained in:
fewtarius 2022-08-06 07:53:49 -04:00 committed by GitHub
commit feb1a2f877
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
}