You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.2 KiB
34 lines
1.2 KiB
commit 84b04b03bd6d31316fd5f0ad1c9cd31952671998 |
|
Author: Daniel Veillard <veillard@redhat.com> |
|
Date: Tue Apr 22 15:30:56 2014 +0800 |
|
|
|
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> |
|
|
|
diff --git a/parser.c b/parser.c |
|
index 3c72cbb..32f1475 100644 |
|
--- a/parser.c |
|
+++ b/parser.c |
|
@@ -2622,6 +2622,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.
|
|
|