aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-12-21 08:20:41 +0100
committerLennart Poettering <lennart@poettering.net>2018-12-21 16:15:14 +0100
commit5f9026027da6e7286ae7d420829d300276e5957b (patch)
treea0be66899619ef68194af349fe2da87f5d8e970c
parentudevadm: add two more assertions (diff)
downloadsystemd-5f9026027da6e7286ae7d420829d300276e5957b.tar.gz
systemd-5f9026027da6e7286ae7d420829d300276e5957b.tar.bz2
systemd-5f9026027da6e7286ae7d420829d300276e5957b.zip
analyze: add assert to verify we are not dividing by 0
CID #1397051.
-rw-r--r--src/analyze/analyze-security.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/analyze/analyze-security.c b/src/analyze/analyze-security.c
index 8373819cd..1fc3c1e02 100644
--- a/src/analyze/analyze-security.c
+++ b/src/analyze/analyze-security.c
@@ -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++)