firmware: make it a bit safer still

This commit is contained in:
Franco Fichtner 2024-11-30 11:34:56 +01:00
parent e4d452b37b
commit 4208db6d5f

View File

@ -112,6 +112,9 @@ output_cmd()
shift $((OPTIND - 1))
for ARG in "${@}"; do
# transform first to trap replacements
ARG="$(echo "${ARG}")"
# single quote will not execute for safety
if [ -z "${ARG##*"'"*}" ]; then
output_text "firmware: safety violation in argument during ${REQUEST}"
@ -119,7 +122,7 @@ output_cmd()
fi
# append safely to argument in single quotes
DO_CMD="${DO_CMD} '$(echo ${ARG})'"
DO_CMD="${DO_CMD} '${ARG}'"
done
# pipe needed for grabbing the command return value