analyze: add assert to verify we are not dividing by 0

CID #1397051.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-12-21 08:20:41 +01:00 committed by Lennart Poettering
parent a3ebe5eb62
commit 5f9026027d

View 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++)