]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
domain_conf: Parse full length of some <seclabel/> attributes
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 21 Aug 2019 11:07:57 +0000 (13:07 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 4 Jan 2021 19:18:16 +0000 (20:18 +0100)
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>
src/conf/domain_conf.c

index 384710da408c2b0d6e8311cb0668d63d75d9d81d..5a8947eeec09f76944272ecd1d40d5b18bdca838 100644 (file)
@@ -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,