fix: jssjDB path must not contain more than one ..

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2020-12-16 17:46:55 +01:00
parent 16448a9f60
commit f762d22958

View File

@ -5,7 +5,7 @@
# This file is public domain in the USA and all free countries. # This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
# #
#### $$VERSION$$ v1.2-dev2-6-geda77f8 #### $$VERSION$$ v1.2-dev2-31-g16448a9
# #
# source from commands.sh to use jsonDB functions # source from commands.sh to use jsonDB functions
# #
@ -204,7 +204,7 @@ jssh_checkDB_async() { jssh_checkDB "$@"; }
jssh_checkDB(){ jssh_checkDB(){
local DB local DB
[ -z "$1" ] && return 1 [ -z "$1" ] && return 1
[[ "$1" = *'..'* ]] && return 2 [[ "$1" = *'../.'* ]] && return 2
if [[ "$1" == "${BASHBOT_VAR:-.}"* ]] || [[ "$1" == "${BASHBOT_DATA:-.}"* ]]; then if [[ "$1" == "${BASHBOT_VAR:-.}"* ]] || [[ "$1" == "${BASHBOT_DATA:-.}"* ]]; then
DB="${1}.jssh" DB="${1}.jssh"
else else
@ -296,7 +296,7 @@ jssh_countKeyDB_async() {
fi fi
} }
# updatie key/value in place to jsshDB # update key/value in place to jsshDB
# $1 key name, can only contain -a-zA-Z0-9,._ # $1 key name, can only contain -a-zA-Z0-9,._
# $2 key value # $2 key value
# $3 filename (must exist!), must be relative to BASHBOT_ETC, and not contain '..' # $3 filename (must exist!), must be relative to BASHBOT_ETC, and not contain '..'