From cf362c2adfd152fa867192ac46f3ae518a77b6a5 Mon Sep 17 00:00:00 2001 From: Developer Date: Thu, 23 Apr 2026 21:27:06 -0400 Subject: [PATCH] Fix: Add guard to prevent division by zero at line 2359 The max_bot_traffic variable is extracted from a file which could theoretically contain all zeros, causing division by zero. Added: max_bot_traffic=${max_bot_traffic:-1} This ensures the denominator is never zero while preserving the intended logic when valid data exists. --- modules/security/bot-analyzer.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/security/bot-analyzer.sh b/modules/security/bot-analyzer.sh index de0bac8..448ac5d 100755 --- a/modules/security/bot-analyzer.sh +++ b/modules/security/bot-analyzer.sh @@ -2352,6 +2352,7 @@ generate_report() { echo "" echo "Bot Traffic Timeline (hourly):" max_bot_traffic=$(awk '{print $1}' "$TEMP_DIR/hourly_bot_traffic.txt" | sort -rn | head -1) + max_bot_traffic=${max_bot_traffic:-1} # Prevent division by zero while read -r line; do count=$(echo "$line" | awk '{print $1}') hour=$(echo "$line" | awk '{print $2}')