mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
LSN-2014-0003: Don't expand entities when parsing XML
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> (cherry picked from commit d6b27d3e4c40946efa79e91d134616b41b1666c4)
This commit is contained in:
parent
800eb5ace5
commit
022b34cee7
@ -731,11 +731,11 @@ virXMLParseHelper(int domcode,
|
|||||||
|
|
||||||
if (filename) {
|
if (filename) {
|
||||||
xml = xmlCtxtReadFile(pctxt, filename, NULL,
|
xml = xmlCtxtReadFile(pctxt, filename, NULL,
|
||||||
XML_PARSE_NOENT | XML_PARSE_NONET |
|
XML_PARSE_NONET |
|
||||||
XML_PARSE_NOWARNING);
|
XML_PARSE_NOWARNING);
|
||||||
} else {
|
} else {
|
||||||
xml = xmlCtxtReadDoc(pctxt, BAD_CAST xmlStr, url, NULL,
|
xml = xmlCtxtReadDoc(pctxt, BAD_CAST xmlStr, url, NULL,
|
||||||
XML_PARSE_NOENT | XML_PARSE_NONET |
|
XML_PARSE_NONET |
|
||||||
XML_PARSE_NOWARNING);
|
XML_PARSE_NOWARNING);
|
||||||
}
|
}
|
||||||
if (!xml)
|
if (!xml)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user