From: Stephan Bosch Date: Tue, 9 Nov 2021 23:01:01 +0000 (+0100) Subject: quota: quota-util - Fix bug in quota_is_over() X-Git-Tag: 2.4.1~149 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9bbda636ec79277c288d6cd50d404840d7fd0878;p=thirdparty%2Fdovecot%2Fcore.git quota: quota-util - Fix bug in quota_is_over() The case were the storage is under quota even before deleting the messages and the new allocation exceeds the quota limit was tested with reverse logic. The original test first checks that the allocation is larger than the deletion (which is ok) and subsequently checks that the excess is *smaller* than the ceiling, yielding an over-quota result, which made no sense. --- diff --git a/src/plugins/quota/quota-util.c b/src/plugins/quota/quota-util.c index 08a60d650c..5088e3d296 100644 --- a/src/plugins/quota/quota-util.c +++ b/src/plugins/quota/quota-util.c @@ -69,7 +69,7 @@ quota_is_over(uoff_t alloc, int64_t used, uint64_t ceil, uint64_t over) if (alloc > (deleted - over)) return TRUE; } else { - if (alloc > deleted && (alloc - deleted) < ceil) + if (alloc > deleted && (alloc - deleted) > ceil) return TRUE; } } else if (alloc == 0) {