From: Timo Sirainen Date: Tue, 3 Aug 2021 13:11:35 +0000 (+0300) Subject: acl: Cast enums explicitly to int in sorting function X-Git-Tag: 2.3.17~255 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b79d3118e5711bcecbb69c8a2f8b513b89c84d9c;p=thirdparty%2Fdovecot%2Fcore.git acl: Cast enums explicitly to int in sorting function Fixes ubsan complaint: runtime error: unsigned integer overflow: 0 - 4 cannot be represented in type 'unsigned int' --- diff --git a/src/plugins/acl/acl-api.c b/src/plugins/acl/acl-api.c index 1e864868ae..2e422ea54b 100644 --- a/src/plugins/acl/acl-api.c +++ b/src/plugins/acl/acl-api.c @@ -460,7 +460,7 @@ int acl_rights_cmp(const struct acl_rights *r1, const struct acl_rights *r2) return r1->global ? 1 : -1; } - ret = r1->id_type - r2->id_type; + ret = (int)r1->id_type - (int)r2->id_type; if (ret != 0) return ret;