Skip to content

Commit

Permalink
Merge pull request #211963 from microsoft/tyriar/211884
Browse files Browse the repository at this point in the history
Fix escaping of characters in bash SI script
  • Loading branch information
Tyriar authored May 3, 2024
2 parents e54d7e9 + 97b3360 commit b68cc7d
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,13 @@ __vsc_escape_value() {
for (( i=0; i < "${#str}"; ++i )); do
byte="${str:$i:1}"

# Escape backslashes, semi-colons, escapes, and newlines
# Escape backslashes, semi-colons specially, then special ASCII chars below space (0x20)
if [ "$byte" = "\\" ]; then
token="\\\\"
elif [ "$byte" = ";" ]; then
token="\\x3b"
elif [ "$byte" = $'\n' ]; then
token="\x0a"
elif [ "$byte" = $'\e' ]; then
token="\\x1b"
elif (( $(builtin printf '%d' "'$byte") < 31 )); then
token=$(builtin printf '\\x%02x' "'$byte")
else
token="$byte"
fi
Expand Down

0 comments on commit b68cc7d

Please sign in to comment.