mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-21 08:22:59 +02:00
initscripts fkt: Check for invalid values 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
02254f5543
commit
9f72b7bc5f
@@ -919,6 +919,12 @@ readhash() {
|
||||
continue
|
||||
fi
|
||||
|
||||
# Skip lines with invalid values
|
||||
if ! [[ ${val} =~ ^[\'][\ A-Za-z0-9=/,.:%_@#+-]*[\']$ ]] && ! [[ ${val} =~ ^[A-Za-z0-9=/,.:%_@#+-]*$ ]]; then
|
||||
echo "Invalid value '${val}' for key '${key}'" >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
printf -v "${array}[${key}]" "%s" "${val}"
|
||||
done < "${file}"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user