]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota: quota-util - Fix bug in quota_is_over()
authorStephan Bosch <stephan.bosch@open-xchange.com>
Tue, 9 Nov 2021 23:01:01 +0000 (00:01 +0100)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 26 Feb 2025 10:45:00 +0000 (10:45 +0000)
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.

src/plugins/quota/quota-util.c

index 08a60d650cd6a49accc566c81d0c9b755357f7c9..5088e3d2962da06468556563b4f8198c2f49cda8 100644 (file)
@@ -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) {