Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't load external entities in NSXMLDocuments #737

Merged
merged 2 commits into from Nov 24, 2016
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Next

Don't load external entities in NSXMLDocuments

Fixes #736
  • Loading branch information...
josh64x2 committed Nov 24, 2016
commit a29cc5a7b947ba47edda3423a4da1ad099210be2
@@ -39,7 +39,7 @@ + (void)importFromFile:(NSString *)importFileName
{
NSError *error = nil;
NSXMLDocument *opmlDocument = [[NSXMLDocument alloc] initWithData:data
options:NSXMLNodeOptionsNone
options:NSXMLNodeOptionsNone|NSXMLNodeLoadExternalEntitiesNever
error:&error];
if (error)
{
@@ -55,7 +55,7 @@ -(BOOL)parseRichXML:(NSData *)xmlData

@try {
xmlDocument = [[NSXMLDocument alloc] initWithData:xmlData
options:NSXMLNodeOptionsNone
options:NSXMLNodeLoadExternalEntitiesNever
error:&error];
if (xmlDocument == nil && error != nil) {
if ([error.domain isEqualToString:NSXMLParserErrorDomain]) {
@@ -70,7 +70,7 @@ -(BOOL)parseRichXML:(NSData *)xmlData
}
// recover some cases like text encoding errors, non standard tags...
xmlDocument = [[NSXMLDocument alloc] initWithData:xmlData
options:NSXMLDocumentTidyXML
options:NSXMLDocumentTidyXML|NSXMLNodeLoadExternalEntitiesNever
error:&error];
}
} @catch (NSException * exception) {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.