summaryrefslogtreecommitdiff
path: root/xmllint.c
diff options
context:
space:
mode:
authorDoran Moppert <dmoppert@redhat.com>2017-04-07 16:45:56 +0200
committerDaniel Veillard <veillard@redhat.com>2017-04-07 16:55:05 +0200
commit2304078555896cf1638c628f50326aeef6f0e0d0 (patch)
tree10c77da4ad72b8f0f95b5cc4a65a5bb563ebd4c6 /xmllint.c
parente905f08123e4a6e7731549e6f09dadff4cab65bd (diff)
downloadlibxml2-2304078555896cf1638c628f50326aeef6f0e0d0.tar.gz
Add an XML_PARSE_NOXXE flag to block all entities loading even local
For https://bugzilla.gnome.org/show_bug.cgi?id=772726 * include/libxml/parser.h: Add a new parser flag XML_PARSE_NOXXE * elfgcchack.h, xmlIO.h, xmlIO.c: associated loading routine * include/libxml/xmlerror.h: new error raised * xmllint.c: adds --noxxe flag to activate the option
Diffstat (limited to 'xmllint.c')
-rw-r--r--xmllint.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/xmllint.c b/xmllint.c
index 67f7adb2..d9368c1d 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -3019,6 +3019,7 @@ static void usage(const char *name) {
printf("\t--path 'paths': provide a set of paths for resources\n");
printf("\t--load-trace : print trace of all external entities loaded\n");
printf("\t--nonet : refuse to fetch DTDs or entities over network\n");
+ printf("\t--noxxe : forbid any external entity loading\n");
printf("\t--nocompact : do not generate compact text nodes\n");
printf("\t--htmlout : output results as HTML\n");
printf("\t--nowrap : do not put HTML doc wrapper\n");
@@ -3461,6 +3462,10 @@ main(int argc, char **argv) {
(!strcmp(argv[i], "--nonet"))) {
options |= XML_PARSE_NONET;
xmlSetExternalEntityLoader(xmlNoNetExternalEntityLoader);
+ } else if ((!strcmp(argv[i], "-noxxe")) ||
+ (!strcmp(argv[i], "--noxxe"))) {
+ options |= XML_PARSE_NOXXE;
+ xmlSetExternalEntityLoader(xmlNoXxeExternalEntityLoader);
} else if ((!strcmp(argv[i], "-nocompact")) ||
(!strcmp(argv[i], "--nocompact"))) {
options &= ~XML_PARSE_COMPACT;