diff options
author | Tim Potter <tpot@samba.org> | 2001-06-06 07:15:34 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2001-06-06 07:15:34 +0000 |
commit | b627b65d2b347ea9b08977ecf52bd35457993918 (patch) | |
tree | a232501dca38185b7b5333adb0e86784687e61a2 | |
parent | 5264e9a2a737d6498be0f346bcbc3b583609abf5 (diff) | |
download | samba-b627b65d2b347ea9b08977ecf52bd35457993918.tar.gz samba-b627b65d2b347ea9b08977ecf52bd35457993918.tar.bz2 samba-b627b65d2b347ea9b08977ecf52bd35457993918.zip |
Converted init_samr_q_lookup_names() and samr_io_q_lookup_names()
to use tallocated memory instead of dodgy static arrays.
(This used to be commit 35d27941141ecdc3bfe18651e5225a94d818e8c1)
-rw-r--r-- | source3/rpc_parse/parse_samr.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 0d60880615..56ed41128d 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -4291,7 +4291,7 @@ BOOL samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM * r_u, inits a SAMR_Q_LOOKUP_NAMES structure. ********************************************************************/ -void init_samr_q_lookup_names(SAMR_Q_LOOKUP_NAMES * q_u, +void init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, POLICY_HND *pol, uint32 flags, uint32 num_names, char **name) { @@ -4306,6 +4306,9 @@ void init_samr_q_lookup_names(SAMR_Q_LOOKUP_NAMES * q_u, q_u->ptr = 0; q_u->num_names2 = num_names; + q_u->hdr_name = (UNIHDR *)talloc_zero(ctx, num_names * sizeof(UNIHDR)); + q_u->uni_name = (UNISTR2 *)talloc_zero(ctx, num_names * sizeof(UNISTR2)); + for (i = 0; i < num_names; i++) { int len_name = name[i] != NULL ? strlen(name[i]) : 0; init_uni_hdr(&q_u->hdr_name[i], len_name); /* unicode header for user_name */ @@ -4346,7 +4349,14 @@ BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES * q_u, if(!prs_uint32("num_names2", ps, depth, &q_u->num_names2)) return False; - SMB_ASSERT_ARRAY(q_u->hdr_name, q_u->num_names2); + if (UNMARSHALLING(ps) && (q_u->num_names2 != 0)) { + q_u->hdr_name = (UNIHDR *)prs_alloc_mem(ps, sizeof(UNIHDR) * + q_u->num_names2); + q_u->uni_name = (UNISTR2 *)prs_alloc_mem(ps, sizeof(UNISTR2) * + q_u->num_names2); + if (!q_u->hdr_name || q_u->uni_name) + return False; + } for (i = 0; i < q_u->num_names2; i++) { if(!smb_io_unihdr("", &q_u->hdr_name[i], ps, depth)) |