diff options
author | Johannes Schauer Marin Rodrigues <josch@mister-muffin.de> | 2023-06-30 13:25:09 +0200 |
---|---|---|
committer | Johannes Schauer Marin Rodrigues <josch@mister-muffin.de> | 2023-07-04 05:44:59 +0200 |
commit | 47da2084b5b6c834648666ccd1faf79a0e3a61f4 (patch) | |
tree | eb8796fbef07376bcd49eb16f5005ea5689b88ba | |
parent | b7227a23694cbdd8c8e8c4c81f07f98bfaf7d99d (diff) | |
download | debvm-47da2084b5b6c834648666ccd1faf79a0e3a61f4.tar.gz |
bin/debvm-run: commas in the image filename must be escaped
-rwxr-xr-x | bin/debvm-run | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/debvm-run b/bin/debvm-run index 044cec0..1b45a33 100755 --- a/bin/debvm-run +++ b/bin/debvm-run @@ -348,9 +348,14 @@ set -- \ -initrd "/proc/self/fd/$INITRDFD" \ "$@" +# If the image filename contains a comma, then that comma must be escaped by +# prefixing it with another comma or otherwise output filenames are able to +# inject drive options to qemu (and load the wrong file). +IMAGE_ESCAPED="$(printf "%s" "$IMAGE" | sed 's/,/,,/g')" + if ! check_skip root/dev; then set -- \ - -drive "media=disk,format=raw,discard=unmap,file=$IMAGE,if=virtio,cache=unsafe" \ + -drive "media=disk,format=raw,discard=unmap,file=$IMAGE_ESCAPED,if=virtio,cache=unsafe" \ "$@" fi |