]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli: Try to fix CID 1609583 Overflowed constant
authorVolker Lendecke <vl@samba.org>
Mon, 4 Nov 2024 17:26:43 +0000 (18:26 +0100)
committerRalph Boehme <slow@samba.org>
Tue, 12 Nov 2024 12:09:34 +0000 (12:09 +0000)
Coverity does not like the --i

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
libcli/security/security_descriptor.c

index 9b9f16c6d2ef07779ff375897e7c8f21199bafa0..c550d6ed7510e39130c4146037dcb0bf7d0ca5a5 100644 (file)
@@ -399,7 +399,10 @@ static NTSTATUS security_descriptor_acl_del(struct security_descriptor *sd,
        }
 
        /* there can be multiple ace's for one trustee */
-       for (i=0;i<acl->num_aces;i++) {
+
+       i = 0;
+
+       while (i<acl->num_aces) {
                if (dom_sid_equal(trustee, &acl->aces[i].trustee)) {
                        ARRAY_DEL_ELEMENT(acl->aces, i, acl->num_aces);
                        acl->num_aces--;
@@ -407,7 +410,8 @@ static NTSTATUS security_descriptor_acl_del(struct security_descriptor *sd,
                                acl->aces = NULL;
                        }
                        found = true;
-                       --i;
+               } else {
+                       i += 1;
                }
        }