Skip to content

Commit 1f52136

Browse files
HaxatronAngledLuffa
authored andcommitted
Fix SAXParser security issue
1 parent 76666dd commit 1f52136

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/edu/stanford/nlp/process/TransformXML.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.io.*;
66
import java.util.*;
77

8+
import javax.xml.XMLConstants;
89
import javax.xml.parsers.SAXParser;
910
import javax.xml.parsers.SAXParserFactory;
1011

@@ -195,6 +196,8 @@ public void processText(String text) {
195196

196197
public TransformXML() {
197198
try {
199+
SAXParserFactory spf = SAXParserFactory.newInstance();
200+
spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
198201
saxParser = SAXParserFactory.newInstance().newSAXParser();
199202
} catch (Exception e) {
200203
log.info("Error configuring XML parser: " + e);

0 commit comments

Comments
 (0)