diff options
author | Daniel Veillard <veillard@redhat.com> | 2014-04-22 15:30:56 +0800 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2014-05-06 22:31:51 +0800 |
commit | 9cd1c3cfbd32655d60572c0a413e017260c854df (patch) | |
tree | da08132514c1e340c109981fb87615abe3d3ce6a /parser.c | |
parent | f0dd6e11aa56addced3de33fab30529a51efaed5 (diff) | |
download | android_external_libxml2-9cd1c3cfbd32655d60572c0a413e017260c854df.tar.gz android_external_libxml2-9cd1c3cfbd32655d60572c0a413e017260c854df.tar.bz2 android_external_libxml2-9cd1c3cfbd32655d60572c0a413e017260c854df.zip |
Do not fetch external parameter entities
Unless explicitely asked for when validating or replacing entities
with their value. Problem pointed out by Daniel Berrange <berrange@redhat.com>
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -2598,6 +2598,20 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { xmlCharEncoding enc; /* + * Note: external parsed entities will not be loaded, it is + * not required for a non-validating parser, unless the + * option of validating, or substituting entities were + * given. Doing so is far more secure as the parser will + * only process data coming from the document entity by + * default. + */ + if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) && + ((ctxt->options & XML_PARSE_NOENT) == 0) && + ((ctxt->options & XML_PARSE_DTDVALID) == 0) && + (ctxt->validate == 0)) + return; + + /* * handle the extra spaces added before and after * c.f. http://www.w3.org/TR/REC-xml#as-PE * this is done independently. |