0010-Prevent-unwanted-external-entity-reference.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From: Neel Mehta <nmehta@google.com>
  2. Date: Fri, 7 Apr 2017 17:43:02 +0200
  3. Subject: Prevent unwanted external entity reference
  4. Origin: https://git.gnome.org/browse/libxml2/commit/?id=90ccb58242866b0ba3edbef8fe44214a101c2b3e
  5. Bug: https://bugzilla.gnome.org/show_bug.cgi?id=780691
  6. Bug-Debian: https://bugs.debian.org/870867
  7. Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2017-7375
  8. For https://bugzilla.gnome.org/show_bug.cgi?id=780691
  9. * parser.c: add a specific check to avoid PE reference
  10. ---
  11. parser.c | 9 +++++++++
  12. 1 file changed, 9 insertions(+)
  13. diff --git a/parser.c b/parser.c
  14. index 609a2703..c2c812de 100644
  15. --- a/parser.c
  16. +++ b/parser.c
  17. @@ -8123,6 +8123,15 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt)
  18. if (xmlPushInput(ctxt, input) < 0)
  19. return;
  20. } else {
  21. + if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
  22. + ((ctxt->options & XML_PARSE_NOENT) == 0) &&
  23. + ((ctxt->options & XML_PARSE_DTDVALID) == 0) &&
  24. + ((ctxt->options & XML_PARSE_DTDLOAD) == 0) &&
  25. + ((ctxt->options & XML_PARSE_DTDATTR) == 0) &&
  26. + (ctxt->replaceEntities == 0) &&
  27. + (ctxt->validate == 0))
  28. + return;
  29. +
  30. /*
  31. * TODO !!!
  32. * handle the extra spaces added before and after
  33. --
  34. 2.11.0