From 01ab6513bd5c965cd127dfdaf5ab4470f77d9741 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 22 Nov 2021 17:43:13 +0100 Subject: [PATCH] virSecurityLabelDefParseXML: Don't use virXMLPropStringLimit MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The function produces an error which is ignored in this code path. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/conf/domain_conf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 13395a7023..5cfb2d91eb 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7804,8 +7804,9 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt, g_autofree char *relabel = NULL; g_autoptr(virSecurityLabelDef) seclabel = NULL; - model = virXMLPropStringLimit(ctxt->node, "model", - VIR_SECURITY_MODEL_BUFLEN - 1); + if ((model = virXMLPropString(ctxt->node, "model")) && + strlen(model) >= VIR_SECURITY_MODEL_BUFLEN - 1) + g_clear_pointer(&model, g_free); if (!(seclabel = virSecurityLabelDefNew(model))) return NULL; -- 2.47.2