]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota: quota-imapc - Handle quota limits better
authorAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 20 Aug 2020 06:34:40 +0000 (09:34 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 11 Sep 2020 07:07:20 +0000 (07:07 +0000)
If quota limit is bigger than INT64_MAX, it's unlimited
as we cannot express this anyways.

src/plugins/quota/quota-imapc.c

index f453eae4421be37ae720ba4c94cb48fdd12b5da2..d5931dbdb8c96e99614459ff689c138f0804af93 100644 (file)
@@ -269,8 +269,17 @@ imapc_quota_refresh_update(struct quota *quota,
 
                        root->bytes_last = refresh_root->bytes_cur;
                        root->count_last = refresh_root->count_cur;
-                       root->root.bytes_limit = refresh_root->bytes_limit;
-                       root->root.count_limit = refresh_root->count_limit;
+
+                       /* If limits are higher than what dovecot can handle
+                          consider them unlimited. */
+                       if (refresh_root->bytes_limit > INT64_MAX)
+                               root->root.bytes_limit = 0;
+                       else
+                               root->root.bytes_limit = refresh_root->bytes_limit;
+                       if (refresh_root->count_limit > INT64_MAX)
+                               root->root.count_limit = 0;
+                       else
+                               root->root.count_limit = refresh_root->count_limit;
                }
        }
 }