mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-24 13:35:17 +00:00
Fix parser checking of storage pool device
The storage backend implementations all presume that the XML parser is validating correctness of the source specification. The check for a source device was lost at some point. This allowed for a potential crash in the disk backend. Re-introduce the sanity check * src/conf/storage_conf.c: Re-add check for source device
This commit is contained in:
parent
e609aae673
commit
ce5ced1d00
@ -689,6 +689,15 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If DEVICE is the only source type, then its required */
|
||||||
|
if (options->flags == VIR_STORAGE_POOL_SOURCE_DEVICE) {
|
||||||
|
if (!ret->source.ndevice) {
|
||||||
|
virStorageReportError(VIR_ERR_XML_ERROR,
|
||||||
|
"%s", _("missing storage pool source device name"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((ret->target.path = virXPathString("string(./target/path)", ctxt)) == NULL) {
|
if ((ret->target.path = virXPathString("string(./target/path)", ctxt)) == NULL) {
|
||||||
virStorageReportError(VIR_ERR_XML_ERROR,
|
virStorageReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("missing storage pool target path"));
|
"%s", _("missing storage pool target path"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user