initscripts fkt: readhash should only parse lines with a =

A line without a = is clearly invalid.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Jonatan Schlag
2024-06-16 18:02:42 +02:00
committed by Michael Tremer
parent 9f72b7bc5f
commit f1d94e7457
3 changed files with 8 additions and 0 deletions

View File

@@ -910,6 +910,12 @@ readhash() {
continue
fi
# Skip lines without a =
if ! [[ ${line} =~ [^=]*=[^=]*$ ]]; then
echo "Invalid line '${line}'" >&2
continue
fi
local key="${line%=*}"
local val="${line#*=}"