Skip to content

Commit

Permalink
fix: DTD processing
Browse files Browse the repository at this point in the history
  • Loading branch information
SenexCrenshaw committed Feb 8, 2024
1 parent bec0b91 commit 643b704
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -366,4 +366,3 @@ epg.xml
m3u.m3u
ghtoken
Dockerfile
Dockerfile
10 changes: 9 additions & 1 deletion StreamMaster.Domain/Common/FileUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Net;
using System.Text;
using System.Text.Json;
using System.Xml;
using System.Xml.Serialization;

namespace StreamMaster.Domain.Common;
Expand Down Expand Up @@ -43,9 +44,16 @@ public static string CleanUpFileName(string fullName)

try
{
XmlReaderSettings settings = new()
{
DtdProcessing = DtdProcessing.Parse,
ValidationType = ValidationType.DTD,
MaxCharactersFromEntities = 1024
};

XmlSerializer serializer = new(typeof(XMLTV));
using Stream reader = GetFileDataStream(filepath);
using Stream fileStream = GetFileDataStream(filepath);
using XmlReader reader = XmlReader.Create(fileStream, settings);
object? result = serializer.Deserialize(reader);
return (XMLTV?)result;
}
Expand Down

0 comments on commit 643b704

Please sign in to comment.