]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota: Fix integer type in quota_warning_match()
authorAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 13 Feb 2025 07:31:47 +0000 (09:31 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 13 Feb 2025 13:02:44 +0000 (15:02 +0200)
Found by static analysis

src/plugins/quota/quota-util.c

index f4d59359bfca371609ea3ca6a8d330f7d9cc4ba3..0409ce40a8da05186354f73a2bb9cc05c8428a7c 100644 (file)
@@ -10,10 +10,10 @@ bool quota_warning_match(const struct quota_root_settings *w,
 {
 #define QUOTA_EXCEEDED(before, current, limit) \
        ((before) < (uint64_t)(limit) && (current) >= (uint64_t)(limit))
-       uint64_t bytes_limit = w->quota_storage_size *
-               w->quota_storage_percentage / 100;
-       uint64_t count_limit = w->quota_message_count *
-               w->quota_message_percentage / 100;
+       uint64_t bytes_limit = (uint64_t)w->quota_storage_size *
+               (uint64_t)w->quota_storage_percentage / 100ULL;
+       uint64_t count_limit = (uint64_t)w->quota_message_count *
+               (uint64_t)w->quota_message_percentage / 100ULL;
        if (strcmp(w->quota_warning_threshold, QUOTA_WARNING_THRESHOLD_OVER) == 0) {
                /* over quota (default) */
                if (strcmp(w->quota_warning_resource, QUOTA_WARNING_RESOURCE_STORAGE) == 0 &&