Resolve fortify defects missed in 13b9701 (#116)

pull/10111/head
Christy Henriksson 8 years ago
parent 3c672416f1
commit ad70f7ba73

@ -133,9 +133,13 @@ private static XDocument SafeXmlTransform(XmlReader reader, XslCompiledTransform
private static XslCompiledTransform SafeLoadXslTransform(string resourceName)
{
var transform = new XslCompiledTransform();
// CodeAnalysis / XmlReader.Create: provide settings instance and set resolver property to null or instance
var reader = XmlReader.Create(new StreamReader(GetResourceStream(resourceName)), new XmlReaderSettings());
var settings = new XmlReaderSettings
{
XmlResolver = null
};
var reader = XmlReader.Create(new StreamReader(GetResourceStream(resourceName)), settings);
// CodeAnalysis / XslCompiledTransform.Load: specify default settings or set resolver property to null or instance
transform.Load(reader, XsltSettings.Default, stylesheetResolver: null);

@ -90,7 +90,11 @@ private static T ReadFromXml<T>(string path)
using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
// CodeAnalysis / XmlReader.Create: provide settings instance and set resolver property to null or instance
var reader = XmlReader.Create(stream, new XmlReaderSettings());
var settings = new XmlReaderSettings()
{
XmlResolver = null
};
var reader = XmlReader.Create(stream, settings);
return (T)xmlSerializer.Deserialize(reader);
}
}

Loading…
Cancel
Save