From 911a775a9027b752785bb4ecd7daa8320103c8bb Mon Sep 17 00:00:00 2001 From: Kroese Date: Fri, 19 Jan 2024 03:45:25 +0100 Subject: [PATCH] fix: Sanitize filename (#351) --- src/install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/install.sh b/src/install.sh index f23bc22..f245745 100644 --- a/src/install.sh +++ b/src/install.sh @@ -21,7 +21,9 @@ fi BASE=$(basename "$BOOT") BASE="${BASE%%\?*}" - +: "${BASE//+/ }"; printf -v BASE '%b' "${_//%/\\x}" +BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g') + [ -f "$STORAGE/$BASE" ] && return 0 TMP="$STORAGE/${BASE%.*}.tmp"