From: Michael Tremer Date: Mon, 22 Dec 2025 12:44:01 +0000 (+0000) Subject: dnsbl: analyze: Don't divide by zero when a source is empty X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9dfb7bfe6c97db63d0ddfe2cc02d4e1da15565d;p=dbl.git dnsbl: analyze: Don't divide by zero when a source is empty Signed-off-by: Michael Tremer --- 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