Skip to content

Commit 25c6704

Browse files
committed
Fix support external entities for DOM driver.
1 parent c9b121a commit 25c6704

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

xstream/src/java/com/thoughtworks/xstream/io/xml/DomDriver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public DomDriver(final String encoding, final NameCoder nameCoder) {
6464
this.encoding = encoding;
6565
documentBuilderFactory = DocumentBuilderFactory.newInstance();
6666
try {
67-
documentBuilderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false);
67+
documentBuilderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
6868
} catch (final ParserConfigurationException e) {
6969
throw new StreamException(e);
7070
}

xstream/src/test/com/thoughtworks/xstream/io/xml/DomReaderTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (C) 2004, 2005 Joe Walnes.
3-
* Copyright (C) 2006, 2007 XStream Committers.
3+
* Copyright (C) 2006, 2007, 2015 XStream Committers.
44
* All rights reserved.
55
*
66
* The software in this package is published under the terms of the BSD
@@ -90,8 +90,8 @@ public void testIsXXEVulnerable() throws Exception {
9090
super.testIsXXEVulnerable();
9191
fail("Thrown " + XStreamException.class.getName() + " expected");
9292
} catch (final XStreamException e) {
93-
final String message = e.getMessage().toLowerCase();
94-
if (message.contains("Package")) {
93+
final String message = e.getMessage();
94+
if (!message.contains("DOCTYPE")) {
9595
throw e;
9696
}
9797
}

0 commit comments

Comments
 (0)