Blame SOURCES/libxml2-Do-not-fetch-external-parameter-entities.patch

0c7906
commit 84b04b03bd6d31316fd5f0ad1c9cd31952671998
0c7906
Author: Daniel Veillard <veillard@redhat.com>
0c7906
Date:   Tue Apr 22 15:30:56 2014 +0800
0c7906
0c7906
    Do not fetch external parameter entities
0c7906
    
0c7906
    Unless explicitely asked for when validating or replacing entities
0c7906
    with their value. Problem pointed out by Daniel Berrange <berrange@redhat.com>
0c7906
0c7906
diff --git a/parser.c b/parser.c
0c7906
index 3c72cbb..32f1475 100644
0c7906
--- a/parser.c
0c7906
+++ b/parser.c
0c7906
@@ -2622,6 +2622,20 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
0c7906
 		    xmlCharEncoding enc;
0c7906
 
0c7906
 		    /*
0c7906
+		     * Note: external parsed entities will not be loaded, it is
0c7906
+		     * not required for a non-validating parser, unless the
0c7906
+		     * option of validating, or substituting entities were
0c7906
+		     * given. Doing so is far more secure as the parser will
0c7906
+		     * only process data coming from the document entity by
0c7906
+		     * default.
0c7906
+		     */
0c7906
+                    if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
0c7906
+		        ((ctxt->options & XML_PARSE_NOENT) == 0) &&
0c7906
+			((ctxt->options & XML_PARSE_DTDVALID) == 0) &&
0c7906
+			(ctxt->validate == 0))
0c7906
+			return;
0c7906
+
0c7906
+		    /*
0c7906
 		     * handle the extra spaces added before and after
0c7906
 		     * c.f. http://www.w3.org/TR/REC-xml#as-PE
0c7906
 		     * this is done independently.