]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
acl: Cast enums explicitly to int in sorting function
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 3 Aug 2021 13:11:35 +0000 (16:11 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 3 Aug 2021 13:12:28 +0000 (16:12 +0300)
Fixes ubsan complaint:
runtime error: unsigned integer overflow: 0 - 4 cannot be represented in type 'unsigned int'

src/plugins/acl/acl-api.c

index 1e864868ae604c2a8f07d1e78b280dcc24f4f039..2e422ea54b77fe9c349e046d1dfd5d1a8cba6f0b 100644 (file)
@@ -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;