From: Volker Lendecke Date: Tue, 20 May 2008 15:29:40 +0000 (+0200) Subject: Fix a valgrind error in _samr_LookupNames X-Git-Tag: samba-3.3.0pre1~1188^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=89f87efa2394e99802ca23307e712fc5820a5fc6;p=thirdparty%2Fsamba.git Fix a valgrind error in _samr_LookupNames (cherry picked from commit fb0a25d59ddd28ea1d5af33ec7d9f817fac3fb9d) --- diff --git a/source/rpc_server/srv_samr_nt.c b/source/rpc_server/srv_samr_nt.c index f28c771d3ed..42431bd4825 100644 --- a/source/rpc_server/srv_samr_nt.c +++ b/source/rpc_server/srv_samr_nt.c @@ -1786,8 +1786,8 @@ NTSTATUS _samr_LookupNames(pipes_struct *p, struct samr_LookupNames *r) { NTSTATUS status; - uint32 rid[MAX_SAM_ENTRIES]; - enum lsa_SidType type[MAX_SAM_ENTRIES]; + uint32 *rid; + enum lsa_SidType *type; int i; int num_rids = r->in.num_names; DOM_SID pol_sid; @@ -1796,9 +1796,6 @@ NTSTATUS _samr_LookupNames(pipes_struct *p, DEBUG(5,("_samr_LookupNames: %d\n", __LINE__)); - ZERO_ARRAY(rid); - ZERO_ARRAY(type); - if (!get_lsa_policy_samr_sid(p, r->in.domain_handle, &pol_sid, &acc_granted, NULL)) { return NT_STATUS_OBJECT_TYPE_MISMATCH; } @@ -1815,6 +1812,12 @@ NTSTATUS _samr_LookupNames(pipes_struct *p, DEBUG(5,("_samr_LookupNames: truncating entries to %d\n", num_rids)); } + rid = talloc_array(p->mem_ctx, uint32, num_rids); + NT_STATUS_HAVE_NO_MEMORY(rid); + + type = talloc_array(p->mem_ctx, enum lsa_SidType, num_rids); + NT_STATUS_HAVE_NO_MEMORY(rid); + DEBUG(5,("_samr_LookupNames: looking name on SID %s\n", sid_string_dbg(&pol_sid)));