mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-03-25 21:39:03 +02:00
get.sh xbget: don't use eval for file/dir checks
the actual code works fine, but it's quite hacky. there are times when use of eval is acceptable; this is not one of those times, but i'd used it in this instance when i was being a bit crazy about code size reductions during my audits. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -77,12 +77,13 @@ xbget()
|
||||
[ "$1" = "curl" ] || [ "$1" = "copy" ] || [ "$1" = "git" ] || \
|
||||
err "Bad dlop (arg 1): xbget $*"
|
||||
|
||||
echk="f" && [ "$1" = "git" ] && echk="d"
|
||||
|
||||
for url in "$2" "$3"; do
|
||||
[ -n "$url" ] || err "empty URL given in: xbget $*"
|
||||
try_file "$url" "$@" || continue
|
||||
eval "[ -$echk \"$4\" ] || continue"
|
||||
case "$1" in
|
||||
git) [ -d "$4" ] || continue ;;
|
||||
*) [ -f "$4" ] || continue ;;
|
||||
esac
|
||||
return 0 # successful download/copy
|
||||
done
|
||||
err "$1 $2 $3 $4: not downloaded"; :
|
||||
|
||||
Reference in New Issue
Block a user