]> xenbits.xensource.com Git - libvirt.git/commitdiff
LSN-2014-0003: Don't expand entities when parsing XML
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 15 Apr 2014 10:20:29 +0000 (11:20 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 6 May 2014 13:04:45 +0000 (14:04 +0100)
If the XML_PARSE_NOENT flag is passed to libxml2, then any
entities in the input document will be fully expanded. This
allows the user to read arbitrary files on the host machine
by creating an entity pointing to a local file. Removing
the XML_PARSE_NOENT flag means that any entities are left
unchanged by the parser, or expanded to "" by the XPath
APIs.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/util/virxml.c

index 9f00f62cc64b8f1cbe63e7c8c25e35dbac8e66ec..34af64a01fa9ac31f5cd0f40b9eda0a210e62472 100644 (file)
@@ -746,11 +746,11 @@ virXMLParseHelper(int domcode,
 
     if (filename) {
         xml = xmlCtxtReadFile(pctxt, filename, NULL,
-                              XML_PARSE_NOENT | XML_PARSE_NONET |
+                              XML_PARSE_NONET |
                               XML_PARSE_NOWARNING);
     } else {
         xml = xmlCtxtReadDoc(pctxt, BAD_CAST xmlStr, url, NULL,
-                             XML_PARSE_NOENT | XML_PARSE_NONET |
+                             XML_PARSE_NONET |
                              XML_PARSE_NOWARNING);
     }
     if (!xml)