From 82b959ad02d4fdc0a89e15b104e91b63b99f9314 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 23 Sep 2022 15:11:59 +0200 Subject: [PATCH] security: aa-helper: Use virXMLParse instead of virXMLParseString MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Use the helper with more features to validate the root XML element name instead of open-coding it. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/security/virt-aa-helper.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index ceadaef99b..a15971b9bb 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -573,13 +573,8 @@ caps_mockup(vahControl * ctl, const char *xmlStr) g_autoptr(xmlXPathContext) ctxt = NULL; char *arch; - if (!(xml = virXMLParseStringCtxt(xmlStr, _("(domain_definition)"), - &ctxt))) { - return -1; - } - - if (!virXMLNodeNameEqual(ctxt->node, "domain")) { - vah_error(NULL, 0, _("unexpected root element, expecting ")); + if (!(xml = virXMLParse(NULL, xmlStr, _("(domain_definition)"), + "domain", &ctxt, NULL, false))) { return -1; } -- 2.47.2