mirror of
https://github.com/pi-hole/pi-hole
synced 2024-11-19 06:38:17 +00:00
Properly escape domain regex
Dots in domain names should not match any character. Signed-off-by: Niklas Elmose Andersen <mail@niklasea.dk>
This commit is contained in:
parent
989d1aff60
commit
a3e32d9a15
@ -176,11 +176,12 @@ fi
|
|||||||
# 2. Remove comments after domain
|
# 2. Remove comments after domain
|
||||||
# 3. Remove hosts format IP address
|
# 3. Remove hosts format IP address
|
||||||
# 4. Remove any lines that no longer contain the queried domain name (in case the matched domain name was in a comment)
|
# 4. Remove any lines that no longer contain the queried domain name (in case the matched domain name was in a comment)
|
||||||
|
esc_domain="${domainQuery//./\\.}"
|
||||||
mapfile -t results <<< "$(IFS=$'\n'; sed \
|
mapfile -t results <<< "$(IFS=$'\n'; sed \
|
||||||
-e "/:#/d" \
|
-e "/:#/d" \
|
||||||
-e "s/[ \\t]#.*//g" \
|
-e "s/[ \\t]#.*//g" \
|
||||||
-e "s/:.*[ \\t]/:/g" \
|
-e "s/:.*[ \\t]/:/g" \
|
||||||
-e "/${domainQuery}/!d" \
|
-e "/${esc_domain}/!d" \
|
||||||
<<< "${results[*]}")"
|
<<< "${results[*]}")"
|
||||||
# Exit if result was in a comment
|
# Exit if result was in a comment
|
||||||
[[ -z "${results[*]}" ]] && exit 0
|
[[ -z "${results[*]}" ]] && exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user