Skip to content

Commit

Permalink
SDL | Changing ReadXml to a more secure overload. (dotnet#2147)
Browse files Browse the repository at this point in the history
  • Loading branch information
Javad authored and dauinsight committed May 17, 2024
1 parent 39b13a6 commit 575ac0a
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 575ac0a

Please sign in to comment.