Skip to content

Commit

Permalink
phyp: Checking for NULL values when building new guest
Browse files Browse the repository at this point in the history
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()
  • Loading branch information
Eduardo Otubo authored and veillard committed Sep 29, 2010
1 parent 8bd11f3 commit ee2cb98
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/phyp/phyp_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ee2cb98

Please sign in to comment.