mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-19 23:43:00 +02:00
initscripts fkt: ignore invalid keys in readhash
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org> Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
committed by
Michael Tremer
parent
d289bc28be
commit
02254f5543
@@ -913,6 +913,12 @@ readhash() {
|
||||
local key="${line%=*}"
|
||||
local val="${line#*=}"
|
||||
|
||||
# Skip lines with an invalid key
|
||||
if ! [[ ${key} =~ ^[A-Za-z_][A-Za-z0-9_]*$ ]]; then
|
||||
echo "Invalid key '${key}'" >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
printf -v "${array}[${key}]" "%s" "${val}"
|
||||
done < "${file}"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user