提交 ee2cb983 编写于 作者: E Eduardo Otubo 提交者: Daniel Veillard

phyp: Checking for NULL values when building new guest

When creating a new gust, the function phypBuildLpar() was not
checking for NULL values

src/phyp/phyp_driver.c: check the definition arguments to avoid a segmentation
  fault in phypBuildLpar()
上级 8bd11f37
......@@ -3701,6 +3701,29 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def)
int exit_status = 0;
virBuffer buf = VIR_BUFFER_INITIALIZER;
if (!def->memory) {
PHYP_ERROR(VIR_ERR_XML_ERROR,"%s",
_("Field \"<memory>\" on the domain XML file is missing or has "
"invalid value."));
goto err;
}
if (!def->maxmem) {
PHYP_ERROR(VIR_ERR_XML_ERROR,"%s",
_("Field \"<currentMemory>\" on the domain XML file is missing or"
" has invalid value."));
goto err;
}
if (def->ndisks > 0) {
if (!def->disks[0]->src) {
PHYP_ERROR(VIR_ERR_XML_ERROR,"%s",
_("Field \"<src>\" under \"<disk>\" on the domain XML file is "
"missing."));
goto err;
}
}
virBufferAddLit(&buf, "mksyscfg");
if (system_type == HMC)
virBufferVSprintf(&buf, " -m %s", managed_system);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册