mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2026-02-05 07:23:59 +00:00
AdvancedBlocking: fixed null ref bug caused when url entry is returned null for simple/regex blocked domains.
This commit is contained in:
@@ -539,14 +539,14 @@ namespace AdvancedBlocking
|
||||
|
||||
if (blockedRegex is null)
|
||||
{
|
||||
if (blockListUrl is not null)
|
||||
if (blockListUrl.Uri is not null)
|
||||
blockingReport += "; blockListUrl=" + blockListUrl.Uri.AbsoluteUri + "; domain=" + blockedDomain;
|
||||
else
|
||||
blockingReport += "; domain=" + blockedDomain;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (blockListUrl is not null)
|
||||
if (blockListUrl.Uri is not null)
|
||||
blockingReport += "; regexBlockListUrl=" + blockListUrl.Uri.AbsoluteUri + "; regex=" + blockedRegex;
|
||||
else
|
||||
blockingReport += "; regex=" + blockedRegex;
|
||||
@@ -674,6 +674,14 @@ namespace AdvancedBlocking
|
||||
|
||||
#region constructor
|
||||
|
||||
public UrlEntry(Uri uri, Group group)
|
||||
{
|
||||
_uri = uri;
|
||||
_blockAsNxDomain = group.BlockAsNxDomain;
|
||||
_aRecords = group.ARecords;
|
||||
_aaaaRecords = group.AAAARecords;
|
||||
}
|
||||
|
||||
public UrlEntry(JsonElement jsonUrl, Group group)
|
||||
{
|
||||
switch (jsonUrl.ValueKind)
|
||||
@@ -980,7 +988,7 @@ namespace AdvancedBlocking
|
||||
//found zone blocked
|
||||
blockedDomain = foundZone1;
|
||||
blockedRegex = null;
|
||||
listUrl = null;
|
||||
listUrl = new UrlEntry(null, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1000,7 +1008,7 @@ namespace AdvancedBlocking
|
||||
//found pattern blocked
|
||||
blockedDomain = null;
|
||||
blockedRegex = blockedPattern1;
|
||||
listUrl = null;
|
||||
listUrl = new UrlEntry(null, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user