s3-util_sid use ARRAY_SIZE() to ensure we never overflow the dom_sid
authorAndrew Bartlett <abartlet@samba.org>
Sat, 4 Sep 2010 04:05:59 +0000 (14:05 +1000)
committerJeremy Allison <jra@samba.org>
Tue, 14 Sep 2010 21:48:49 +0000 (14:48 -0700)
This ensures that this, unlike the MAXSUBAUTHS macro, can't get
out of sync with the structure.

Andrew Bartlett

source3/lib/util_sid.c

index 9a2876baece534510dd3c6c5397e98d4366c47fc..1f65f779912cea7e22e9a08859bfd60e03924b0c 100644 (file)
@@ -293,7 +293,7 @@ format_error:
 
 bool sid_append_rid(struct dom_sid *sid, uint32_t rid)
 {
-       if (sid->num_auths < MAXSUBAUTHS) {
+       if (sid->num_auths < ARRAY_SIZE(sid->sub_auths)) {
                sid->sub_auths[sid->num_auths++] = rid;
                return true;
        }