Skip to content

Commit

Permalink
login: fix argument escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
champignoom authored and sylirre committed Oct 20, 2024
1 parent 84719e4 commit b8e94ca
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions proot-distro.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1643,15 +1643,10 @@ command_login() {
set -u
done
unset var

local -a login_shell_args

if [ $# -ge 1 ]; then
# Wrap in quotes each argument to prevent word splitting.
local -a login_shell_args
for i in "$@"; do
login_shell_args+=("'$i'")
done
set -- "-c" "${login_shell_args[*]}"
# Escape each argument to prevent word splitting.
set -- "-c" "$(printf " %q" "$@")"
else
set --
fi
Expand Down

0 comments on commit b8e94ca

Please sign in to comment.