]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
analyze: add assert to verify we are not dividing by 0
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 21 Dec 2018 07:20:41 +0000 (08:20 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 21 Dec 2018 15:15:14 +0000 (16:15 +0100)
CID #1397051.

src/analyze/analyze-security.c

index 8373819cd47a65322c6e2026c8110ab6a79655ad..1fc3c1e02f06edca705a41fa46d9bffa4b8cbd8d 100644 (file)
@@ -1533,6 +1533,7 @@ static int assess(const struct security_info *info, Table *overview_table, Analy
                         return log_error_errno(r, "Failed to output table: %m");
         }
 
+        assert(weight_sum > 0);
         exposure = DIV_ROUND_UP(badness_sum * 100U, weight_sum);
 
         for (i = 0; i < ELEMENTSOF(badness_table); i++)