]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
acl: acl_rights_sort() - Handle zero sized rights array properly
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 12 Aug 2020 12:46:31 +0000 (15:46 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 11 Sep 2020 07:40:35 +0000 (07:40 +0000)
Fixes ubsan complaint about count-dest wrapping to negative.
The array code handled this properly though, so nothing was broken.

src/plugins/acl/acl-api.c

index 87d76ebd0a7ae4b8f1782d16e3e020d942d9ce0c..1e864868ae604c2a8f07d1e78b280dcc24f4f039 100644 (file)
@@ -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);
 }