Skip to content

Commit b72df95

Browse files
authored
Merge pull request #842 from nginx-proxy/fix-841
Prevent endless loop of wildcard enumeration
2 parents 2b5fd94 + dddd7a5 commit b72df95

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

app/functions.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ function ascending_wildcard_locations {
4343
until [[ "$domain" =~ $regex ]]; do
4444
first_label="${domain%%.*}"
4545
domain="${domain/${first_label}./}"
46-
echo "*.${domain}"
46+
if [[ -z "$domain" ]]; then
47+
return
48+
else
49+
echo "*.${domain}"
50+
fi
4751
done
4852
}
4953

@@ -59,7 +63,11 @@ function descending_wildcard_locations {
5963
until [[ "$domain" =~ $regex ]]; do
6064
last_label="${domain##*.}"
6165
domain="${domain/.${last_label}/}"
62-
echo "${domain}.*"
66+
if [[ -z "$domain" ]]; then
67+
return
68+
else
69+
echo "${domain}.*"
70+
fi
6371
done
6472
}
6573

0 commit comments

Comments
 (0)