From: Aki Tuomi Date: Thu, 20 Aug 2020 13:24:41 +0000 (+0300) Subject: quota: quota_free_bytes - Check we don't decrease more than INT64_MAX X-Git-Tag: 2.3.13~190 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bbca56c946487c537d2ab8fe781ad73eede195dd;p=thirdparty%2Fdovecot%2Fcore.git quota: quota_free_bytes - Check we don't decrease more than INT64_MAX Otherwise we get overflow --- diff --git a/src/plugins/quota/quota.c b/src/plugins/quota/quota.c index ee9debc407..1457ffe654 100644 --- a/src/plugins/quota/quota.c +++ b/src/plugins/quota/quota.c @@ -1460,7 +1460,8 @@ void quota_alloc(struct quota_transaction_context *ctx, struct mail *mail) void quota_free_bytes(struct quota_transaction_context *ctx, uoff_t physical_size) { - ctx->bytes_used -= physical_size; + i_assert(physical_size <= INT64_MAX); + ctx->bytes_used -= (int64_t)physical_size; ctx->count_used--; }