diff options
author | Jeremy Allison <jra@samba.org> | 2001-06-29 08:12:52 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-06-29 08:12:52 +0000 |
commit | 5c09e95e3928c821b2a0322b720305a61d2b104e (patch) | |
tree | 44badb9cdbd5ba567a0cbe85d836c6566fa260de | |
parent | 3e21695a9f797475de43125776f70573e27fbf11 (diff) | |
download | samba-5c09e95e3928c821b2a0322b720305a61d2b104e.tar.gz samba-5c09e95e3928c821b2a0322b720305a61d2b104e.tar.xz samba-5c09e95e3928c821b2a0322b720305a61d2b104e.zip |
Removing static arrays is always good :-).
Jeremy.
-rw-r--r-- | source/include/rpc_samr.h | 4 | ||||
-rw-r--r-- | source/rpc_parse/parse_samr.c | 21 |
2 files changed, 18 insertions, 7 deletions
diff --git a/source/include/rpc_samr.h b/source/include/rpc_samr.h index cfe856b07fe..20a4f5b8a07 100644 --- a/source/include/rpc_samr.h +++ b/source/include/rpc_samr.h @@ -786,8 +786,8 @@ typedef struct samr_str_entry_info1 typedef struct sam_entry_info_1 { - SAM_ENTRY1 sam[MAX_SAM_ENTRIES]; - SAM_STR1 str[MAX_SAM_ENTRIES]; + SAM_ENTRY1 *sam; + SAM_STR1 *str; } SAM_DISPINFO_1; diff --git a/source/rpc_parse/parse_samr.c b/source/rpc_parse/parse_samr.c index d0f9a665dac..b2ee49990e4 100644 --- a/source/rpc_parse/parse_samr.c +++ b/source/rpc_parse/parse_samr.c @@ -23,7 +23,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - #include "includes.h" #include "rpc_parse.h" #include "nterr.h" @@ -1435,16 +1434,28 @@ static BOOL sam_io_sam_dispinfo_1(char *desc, SAM_DISPINFO_1 * sam, { uint32 i; - if (sam == NULL) - return False; - prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_1"); depth++; if(!prs_align(ps)) return False; - SMB_ASSERT_ARRAY(sam->sam, num_entries); + if (UNMARSHALLING(ps) && num_entries > 0) { + + if ((sam->sam = (SAM_ENTRY1 *) + prs_alloc_mem(ps, sizeof(SAM_ENTRY1) * + num_entries)) == NULL) { + DEBUG(0, ("out of memory allocating SAM_ENTRY1\n")); + return False; + } + + if ((sam->str = (SAM_STR1 *) + prs_alloc_mem(ps, sizeof(SAM_STR1) * + num_entries)) == NULL) { + DEBUG(0, ("out of memory allocating SAM_STR1\n")); + return False; + } + } for (i = 0; i < num_entries; i++) { if(!sam_io_sam_entry1("", &sam->sam[i], ps, depth)) |