From: Peter Krempa Date: Thu, 17 Jan 2013 13:07:10 +0000 (+0100) Subject: qemu: Reject attempts to create snapshots with names containig '/' X-Git-Tag: v1.0.2-rc1~69 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=790f912b468657859466215312dbfb0b1a9a1f69;p=thirdparty%2Flibvirt.git qemu: Reject attempts to create snapshots with names containig '/' The snapshot name is used to create path to the definition save file. When the name contains slashes the creation of the file fails. Reject such names. --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2f3fb9e92e..3a54228389 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -11347,6 +11347,16 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, parse_flags))) goto cleanup; + /* reject snapshot names containing slashes as snapshot definitions are + * saved in files containing the name */ + if (!(flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA) && + strchr(def->name, '/')) { + virReportError(VIR_ERR_XML_DETAIL, + _("invalid snapshot name '%s': name can't contain '/'"), + def->name); + goto cleanup; + } + /* reject the VIR_DOMAIN_SNAPSHOT_CREATE_LIVE flag where not supported */ if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_LIVE && (!virDomainObjIsActive(vm) ||