diff options
Diffstat (limited to 'source/rpc_parse/parse_lsa.c')
-rw-r--r-- | source/rpc_parse/parse_lsa.c | 62 |
1 files changed, 37 insertions, 25 deletions
diff --git a/source/rpc_parse/parse_lsa.c b/source/rpc_parse/parse_lsa.c index e1630f79f48..ea249dc5600 100644 --- a/source/rpc_parse/parse_lsa.c +++ b/source/rpc_parse/parse_lsa.c @@ -573,14 +573,17 @@ void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *out, return; } - out->domlist->domains = TALLOC_ARRAY( ctx, DOMAIN_INFO, + if (out->count) { + out->domlist->domains = TALLOC_ARRAY( ctx, DOMAIN_INFO, out->count ); - - if ( !out->domlist->domains ) { - out->status = NT_STATUS_NO_MEMORY; - return; + if ( !out->domlist->domains ) { + out->status = NT_STATUS_NO_MEMORY; + return; + } + } else { + out->domlist->domains = NULL; } - + out->domlist->count = out->count; /* initialize the list of domains and their sid */ @@ -737,9 +740,13 @@ static BOOL lsa_io_dom_query_2(const char *desc, DOM_QUERY_2 *d_q, prs_struct *p return False; if (UNMARSHALLING(ps)) { - d_q->auditsettings = TALLOC_ZERO_ARRAY(ps->mem_ctx, uint32, d_q->count2); - if (!d_q->auditsettings) { - return False; + if (d_q->count2) { + d_q->auditsettings = TALLOC_ZERO_ARRAY(ps->mem_ctx, uint32, d_q->count2); + if (!d_q->auditsettings) { + return False; + } + } else { + d_q->auditsettings = NULL; } } @@ -1118,16 +1125,16 @@ static void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, /* Allocate memory for sids and sid pointers */ - if (num_entries == 0) return; - - if ((sen->ptr_sid = TALLOC_ZERO_ARRAY(mem_ctx, uint32, num_entries )) == NULL) { - DEBUG(3, ("init_lsa_sid_enum(): out of memory for ptr_sid\n")); - return; - } + if (num_entries) { + if ((sen->ptr_sid = TALLOC_ZERO_ARRAY(mem_ctx, uint32, num_entries )) == NULL) { + DEBUG(3, ("init_lsa_sid_enum(): out of memory for ptr_sid\n")); + return; + } - if ((sen->sid = TALLOC_ZERO_ARRAY(mem_ctx, DOM_SID2, num_entries)) == NULL) { - DEBUG(3, ("init_lsa_sid_enum(): out of memory for sids\n")); - return; + if ((sen->sid = TALLOC_ZERO_ARRAY(mem_ctx, DOM_SID2, num_entries)) == NULL) { + DEBUG(3, ("init_lsa_sid_enum(): out of memory for sids\n")); + return; + } } /* Copy across SIDs and SID pointers */ @@ -1563,14 +1570,19 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, q_l->num_entries2 = num_names; q_l->lookup_level = 1; - if ((q_l->uni_name = TALLOC_ZERO_ARRAY(mem_ctx, UNISTR2, num_names)) == NULL) { - DEBUG(3, ("init_q_lookup_names(): out of memory\n")); - return; - } + if (num_names) { + if ((q_l->uni_name = TALLOC_ZERO_ARRAY(mem_ctx, UNISTR2, num_names)) == NULL) { + DEBUG(3, ("init_q_lookup_names(): out of memory\n")); + return; + } - if ((q_l->hdr_name = TALLOC_ZERO_ARRAY(mem_ctx, UNIHDR, num_names)) == NULL) { - DEBUG(3, ("init_q_lookup_names(): out of memory\n")); - return; + if ((q_l->hdr_name = TALLOC_ZERO_ARRAY(mem_ctx, UNIHDR, num_names)) == NULL) { + DEBUG(3, ("init_q_lookup_names(): out of memory\n")); + return; + } + } else { + q_l->uni_name = NULL; + q_l->hdr_name = NULL; } for (i = 0; i < num_names; i++) { |