]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm quota get: Avoid integer overflows with really high quota usage.
authorTimo Sirainen <tss@iki.fi>
Wed, 2 Jun 2010 19:10:23 +0000 (20:10 +0100)
committerTimo Sirainen <tss@iki.fi>
Wed, 2 Jun 2010 19:10:23 +0000 (20:10 +0100)
--HG--
branch : HEAD

src/plugins/quota/doveadm-quota.c

index 0d5668502bba7a559a0112bf735536345eb68789..fc704aadfaafa892b9c1be9eaae8f4add63b09ed 100644 (file)
@@ -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",