diff options
author | Jeremy Allison <jra@samba.org> | 2007-05-04 19:14:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:19:54 -0500 |
commit | 32b9beb164a419b97f00811dbc7a0fb57e086690 (patch) | |
tree | 7b7c44b16bcd52ea4d92f7f2d9e3f124a6c67ac1 | |
parent | e468268335dd797c540dbd278541340d8c01a7d1 (diff) | |
download | samba-32b9beb164a419b97f00811dbc7a0fb57e086690.tar.gz samba-32b9beb164a419b97f00811dbc7a0fb57e086690.tar.bz2 samba-32b9beb164a419b97f00811dbc7a0fb57e086690.zip |
r22673: Fix for Jerry's reversion. We still need to check size
before talloc.
Jeremy.
(This used to be commit 9e4c6ab7392b2dbaccfaced88d3bc7502ff073ee)
-rw-r--r-- | source3/rpc_parse/parse_samr.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 296296ac5a..529ad319bb 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4838,9 +4838,14 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1)) return False; - ptr_sid = TALLOC_ARRAY(ps->mem_ctx, uint32, r_u->num_sids1); - if (!ptr_sid) { - return False; + /* We must always use talloc here even when marshalling. */ + if (r_u->num_sids1) { + ptr_sid = TALLOC_ARRAY(ps->mem_ctx, uint32, r_u->num_sids1); + if (!ptr_sid) { + return False; + } + } else { + ptr_sid = NULL; } for (i = 0; i < r_u->num_sids1; i++) { @@ -4850,7 +4855,14 @@ BOOL samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, } if (UNMARSHALLING(ps)) { - r_u->sid = TALLOC_ARRAY(ps->mem_ctx, DOM_SID2, r_u->num_sids1); + if (r_u->num_sids1) { + r_u->sid = TALLOC_ARRAY(ps->mem_ctx, DOM_SID2, r_u->num_sids1); + if (!r_u->sid) { + return False; + } + } else { + r_u->sid = NULL; + } } for (i = 0; i < r_u->num_sids1; i++) { |