Skip to content

Commit

Permalink
SDL | Changing ReadXml to a more secure overload. (#2147) (#2516)
Browse files Browse the repository at this point in the history
  • Loading branch information
dauinsight authored May 21, 2024
1 parent 77ec674 commit 4db5b55
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Xml;

namespace Microsoft.Data.ProviderBase
{
Expand Down Expand Up @@ -507,9 +508,16 @@ private bool IncludeThisColumn(DataColumn sourceColumn, string[] hiddenColumnNam

private void LoadDataSetFromXml(Stream XmlStream)
{
_metaDataCollectionsDataSet = new DataSet();
_metaDataCollectionsDataSet.Locale = System.Globalization.CultureInfo.InvariantCulture;
_metaDataCollectionsDataSet.ReadXml(XmlStream);
_metaDataCollectionsDataSet = new DataSet
{
Locale = CultureInfo.InvariantCulture
};
XmlReaderSettings settings = new()
{
XmlResolver = null
};
using XmlReader reader = XmlReader.Create(XmlStream, settings);
_metaDataCollectionsDataSet.ReadXml(reader);
}

protected virtual DataTable PrepareCollection(string collectionName, string[] restrictions, DbConnection connection)
Expand Down

0 comments on commit 4db5b55

Please sign in to comment.