From: Timo Sirainen Date: Wed, 12 Aug 2020 12:46:31 +0000 (+0300) Subject: acl: acl_rights_sort() - Handle zero sized rights array properly X-Git-Tag: 2.3.13~187 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3d15b25968bce1a40d6788efb3f7e4cdba3b10bb;p=thirdparty%2Fdovecot%2Fcore.git acl: acl_rights_sort() - Handle zero sized rights array properly Fixes ubsan complaint about count-dest wrapping to negative. The array code handled this properly though, so nothing was broken. --- diff --git a/src/plugins/acl/acl-api.c b/src/plugins/acl/acl-api.c index 87d76ebd0a..1e864868ae 100644 --- a/src/plugins/acl/acl-api.c +++ b/src/plugins/acl/acl-api.c @@ -493,7 +493,7 @@ void acl_rights_sort(struct acl_object *aclobj) rights[dest] = rights[i]; } } - if (++dest != count) + if (++dest < count) array_delete(&aclobj->rights, dest, count - dest); }