mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Fix permissive regex
The `\.?` is too permissive, letting in anything that ends in the domain Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
This commit is contained in:
parent
7086a400e8
commit
e4e22fb58e
2 changed files with 3 additions and 3 deletions
|
@ -141,7 +141,7 @@ AddDomain() {
|
||||||
bool=true
|
bool=true
|
||||||
domain="${1}"
|
domain="${1}"
|
||||||
|
|
||||||
[[ "${wildcard}" == true ]] && domain="\\.?${domain//\./\\.}$"
|
[[ "${wildcard}" == true ]] && domain="(^|\\.)${domain//\./\\.}$"
|
||||||
|
|
||||||
# Is the domain in the list?
|
# Is the domain in the list?
|
||||||
# Search only for exactly matching lines
|
# Search only for exactly matching lines
|
||||||
|
@ -189,7 +189,7 @@ RemoveDomain() {
|
||||||
[[ -z "${type}" ]] && type="--wildcard-only"
|
[[ -z "${type}" ]] && type="--wildcard-only"
|
||||||
domain="${1}"
|
domain="${1}"
|
||||||
|
|
||||||
[[ "${wildcard}" == true ]] && domain="\\.?${domain//\./\\.}$"
|
[[ "${wildcard}" == true ]] && domain="(^|\\.)${domain//\./\\.}$"
|
||||||
|
|
||||||
bool=true
|
bool=true
|
||||||
# Is it in the list?
|
# Is it in the list?
|
||||||
|
|
|
@ -24,5 +24,5 @@ convert_wildcard_to_regex() {
|
||||||
# Remove repeated domains (may have been inserted two times due to A and AAAA blocking)
|
# Remove repeated domains (may have been inserted two times due to A and AAAA blocking)
|
||||||
uniquedomains="$(uniq <<< "${domains}")"
|
uniquedomains="$(uniq <<< "${domains}")"
|
||||||
# Automatically generate regex filters and remove old wildcards file
|
# Automatically generate regex filters and remove old wildcards file
|
||||||
awk '{print "\\.?"$0"$"}' <<< "${uniquedomains}" >> "${regexFile:?}" && rm "${wildcardFile}"
|
awk '{print "(^|\\.)"$0"$"}' <<< "${uniquedomains}" >> "${regexFile:?}" && rm "${wildcardFile}"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue