Skip to content

Commit

Permalink
Merge pull request pi-hole#1856 from pi-hole/release/v5.5.1
Browse files Browse the repository at this point in the history
Release/v5.5.1
  • Loading branch information
PromoFaux authored Aug 4, 2021
2 parents 7e602e0 + 7aa8057 commit fb9bd56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions scripts/pi-hole/php/groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,9 @@ function JSON_error($message = null)
$res['domain'] = $utf8_domain.' ('.$res['domain'].')';
}
}
// Prevent domain and comment fields from returning any arbitary javascript code which could be executed on the browser.
$res['domain'] = htmlentities($res['domain']);
$res['comment'] = htmlentities($res['comment']);
array_push($data, $res);
}

Expand Down
4 changes: 2 additions & 2 deletions scripts/pi-hole/php/savesettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function validCIDRIP($address){
$v6elem = "[0-9A-Fa-f]{1,4}";
// CIDR for IPv6 is any multiple of 4 from 4 up to 128 bit
$v6cidr = "(4";
for ($i=8; $i <= 128; $i+=4) {
for ($i=8; $i <= 128; $i+=4) {
$v6cidr .= "|$i";
}
$v6cidr .= ")";
Expand Down Expand Up @@ -68,7 +68,7 @@ function validDomain($domain_name)
function validDomainWildcard($domain_name)
{
// There has to be either no or at most one "*" at the beginning of a line
$validChars = preg_match("/^((\*.)?[_a-z\d](-*[_a-z\d])*)(\.([_a-z\d](-*[a-z\d])*))*(\.([_a-z\d])*)*$/i", $domain_name);
$validChars = preg_match("/^((\*\.)?[_a-z\d](-*[_a-z\d])*)(\.([_a-z\d](-*[a-z\d])*))*(\.([_a-z\d])*)*$/i", $domain_name);
$lengthCheck = preg_match("/^.{1,253}$/", $domain_name);
$labelLengthCheck = preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $domain_name);
return ( $validChars && $lengthCheck && $labelLengthCheck ); //length of each label
Expand Down

0 comments on commit fb9bd56

Please sign in to comment.