From a6f8c522a0795b88821241870b379d85d3033297 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Wed, 21 Aug 2019 13:07:57 +0200 Subject: [PATCH] domain_conf: Parse full length of some attributes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In virSecurityLabelDefParseXML() we are parsing the 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 Reviewed-by: Ján Tomko --- src/conf/domain_conf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 384710da40..5a8947eeec 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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, -- 2.47.3