From 2234777dd0639c54529ca18cceb47ad1f0d05e40 Mon Sep 17 00:00:00 2001 From: Sukrit Bhatnagar Date: Tue, 17 Apr 2018 04:26:23 +0530 Subject: [PATCH] qemu: Escape commas for qemuBuildDriveDevStr Add comma escaping for disk->vendor and disk->product when being built for the command line (and not from hotplug). Signed-off-by: Sukrit Bhatnagar Reviewed-by: John Ferlan --- src/qemu/qemu_command.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c432fef885..c2ea28bc76 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2114,11 +2114,15 @@ qemuBuildDriveDevStr(const virDomainDef *def, virBufferAsprintf(&opt, ",wwn=0x%s", disk->wwn); } - if (disk->vendor) - virBufferAsprintf(&opt, ",vendor=%s", disk->vendor); + if (disk->vendor) { + virBufferAddLit(&opt, ",vendor="); + virQEMUBuildBufferEscapeComma(&opt, disk->vendor); + } - if (disk->product) - virBufferAsprintf(&opt, ",product=%s", disk->product); + if (disk->product) { + virBufferAddLit(&opt, ",product="); + virQEMUBuildBufferEscapeComma(&opt, disk->product); + } if (disk->bus == VIR_DOMAIN_DISK_BUS_USB) { if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_STORAGE_REMOVABLE)) {