libcli/security: Fix a valgrind error in dom_sid_parse
authorVolker Lendecke <vl@samba.org>
Sat, 23 Jan 2010 12:53:48 +0000 (13:53 +0100)
committerVolker Lendecke <vl@samba.org>
Sat, 23 Jan 2010 15:28:11 +0000 (16:28 +0100)
libcli/security/dom_sid.c

index 9952977fa9efb30c68d1c9a3ca20e04c7a4ac5d7..6a046cd8061b5142f05d32c56fa69599abe777e1 100644 (file)
@@ -113,6 +113,10 @@ bool dom_sid_parse(const char *sidstr, struct dom_sid *ret)
                if (sidstr[i] == '-') num_sub_auths++;
        }
 
+       if (num_sub_auths > ARRAY_SIZE(ret->sub_auths)) {
+               return false;
+       }
+
        ret->sid_rev_num = rev;
        ret->id_auth[0] = 0;
        ret->id_auth[1] = 0;