From dddd7a5a828cbf9cc30d9afa5de06e104a03d44e Mon Sep 17 00:00:00 2001 From: Nicolas Duchon Date: Tue, 3 Aug 2021 23:16:36 +0200 Subject: [PATCH] fix: prevent endless loop of wildcard enumeration --- app/functions.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/functions.sh b/app/functions.sh index cc51898..f8d5497 100644 --- a/app/functions.sh +++ b/app/functions.sh @@ -43,7 +43,11 @@ function ascending_wildcard_locations { until [[ "$domain" =~ $regex ]]; do first_label="${domain%%.*}" domain="${domain/${first_label}./}" - echo "*.${domain}" + if [[ -z "$domain" ]]; then + return + else + echo "*.${domain}" + fi done } @@ -59,7 +63,11 @@ function descending_wildcard_locations { until [[ "$domain" =~ $regex ]]; do last_label="${domain##*.}" domain="${domain/.${last_label}/}" - echo "${domain}.*" + if [[ -z "$domain" ]]; then + return + else + echo "${domain}.*" + fi done }