From: Timo Sirainen Date: Wed, 2 Jun 2010 19:10:23 +0000 (+0100) Subject: doveadm quota get: Avoid integer overflows with really high quota usage. X-Git-Tag: 2.0.beta6~63 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=700539bdf183d93fe332f9337f232784ede626ba;p=thirdparty%2Fdovecot%2Fcore.git doveadm quota get: Avoid integer overflows with really high quota usage. --HG-- branch : HEAD --- diff --git a/src/plugins/quota/doveadm-quota.c b/src/plugins/quota/doveadm-quota.c index 0d5668502b..fc704aadfa 100644 --- a/src/plugins/quota/doveadm-quota.c +++ b/src/plugins/quota/doveadm-quota.c @@ -28,9 +28,9 @@ static void cmd_quota_get_root(struct mail_user *user, struct quota_root *root) printf("%llu/%llu", (unsigned long long)value, (unsigned long long)limit); - if (limit != 0) { + if (limit >= 100) { printf(" (%u%%)", - (unsigned int)(value*100/limit)); + (unsigned int)(value / (limit/100))); } } else if (ret == 0) { printf("%llu/unlimited",