From d0979b21f9885ae288931d65e1c61bc5832b26d4 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Fri, 29 Mar 2024 20:10:15 +0100 Subject: [PATCH] sd-tool: Enhance detection of "share" folder No longer look in default locations (to not mix versions) and variable directories (".", "..") to not inject foreign/malicious code, but try to get the correct path name from the path of the sd-tool script. --- bin/sd-tool | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/sd-tool b/bin/sd-tool index d98a72e..550e8d8 100755 --- a/bin/sd-tool +++ b/bin/sd-tool @@ -9,9 +9,11 @@ # (at your option) any later version. # +BIN_D=$(dirname "$0") + # Detect our "share" folder ... unset SHARE_D -for d in . .. /usr/local /usr; do +for d in "${BIN_D}" "${BIN_D}"/..; do for s in share share/sd-tool; do if [[ -r "${d}/${s}/sd-tool-common.inc.sh" ]]; then SHARE_D="${d}/${s}" -- 2.39.2