From b9dfb7bfe6c97db63d0ddfe2cc02d4e1da15565d Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 22 Dec 2025 12:44:01 +0000 Subject: [PATCH] dnsbl: analyze: Don't divide by zero when a source is empty Signed-off-by: Michael Tremer --- src/scripts/dnsbl.in | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/scripts/dnsbl.in b/src/scripts/dnsbl.in index bcd4596..05ff800 100644 --- a/src/scripts/dnsbl.in +++ b/src/scripts/dnsbl.in @@ -454,8 +454,16 @@ class CLI(object): columns.append("") continue + # Determine the length of the source + length = len(source) + + # Skip if the source is empty + if not length: + columns.append("") + continue + columns.append( - "%.2f%%" % (value / len(source) * 100), + "%.2f%%" % (value / length * 100), ) # Add a row to the table -- 2.47.3