mirror of https://gitee.com/openkylin/libvirt.git
domain_conf: Parse full length of some <seclabel/> attributes
In virSecurityLabelDefParseXML() we are parsing the <seclabel/> element among with its attributes. Some of the attributes are limited in length (because of virNodeGetSecurityModel()), however some are not. And for the latter ones we don't need to use virXMLPropStringLimit() to parse them. Moreover, using VIR_SECURITY_LABEL_BUFLEN as the limit is wrong - we are not storing the parsed strings into a static buffer of that size rather than checking if the string passes string -> enum conversion. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
97bc56d75f
commit
a6f8c522a0
|
@ -7713,8 +7713,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
|
|||
/* set default value */
|
||||
seclabel->type = VIR_DOMAIN_SECLABEL_DYNAMIC;
|
||||
|
||||
p = virXMLPropStringLimit(ctxt->node, "type",
|
||||
VIR_SECURITY_LABEL_BUFLEN - 1);
|
||||
p = virXMLPropString(ctxt->node, "type");
|
||||
if (p) {
|
||||
seclabel->type = virDomainSeclabelTypeFromString(p);
|
||||
if (seclabel->type <= 0) {
|
||||
|
@ -7729,8 +7728,7 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
|
|||
seclabel->relabel = false;
|
||||
|
||||
VIR_FREE(p);
|
||||
p = virXMLPropStringLimit(ctxt->node, "relabel",
|
||||
VIR_SECURITY_LABEL_BUFLEN-1);
|
||||
p = virXMLPropString(ctxt->node, "relabel");
|
||||
if (p) {
|
||||
if (virStringParseYesNo(p, &seclabel->relabel) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
|
|
Loading…
Reference in New Issue