changeset 11467:3b25ca20f005 HEAD

doveadm quota get: Avoid integer overflows with really high quota usage.
author Timo Sirainen <tss@iki.fi>
date Wed, 02 Jun 2010 20:10:23 +0100
parents 5ae4a5c14f5b
children c7ab127fe8ae
files src/plugins/quota/doveadm-quota.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/quota/doveadm-quota.c	Wed Jun 02 19:52:32 2010 +0100
+++ b/src/plugins/quota/doveadm-quota.c	Wed Jun 02 20:10:23 2010 +0100
@@ -28,9 +28,9 @@
 			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",