summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-07-02 21:23:13 +0000
committerJeremy Allison <jra@samba.org>2001-07-02 21:23:13 +0000
commit3d90180af46f8d306c12ffff12c8d57ce1b4cd8b (patch)
tree80bbc2b2d427ebb5744edbfff4972703014abe5a /source3/rpc_parse
parented2fc9622284e928d328c2f91ddf869ca13e0a1e (diff)
downloadsamba-3d90180af46f8d306c12ffff12c8d57ce1b4cd8b.tar.gz
samba-3d90180af46f8d306c12ffff12c8d57ce1b4cd8b.tar.bz2
samba-3d90180af46f8d306c12ffff12c8d57ce1b4cd8b.zip
Fixed auto-alloc of dispinfo code when unmarshalling.
Jeremy. (This used to be commit d4872c94c2e6b63be0fb12e5dd2d0459fda54959)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_samr.c68
1 files changed, 64 insertions, 4 deletions
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c
index b173b34403..ec5af24d6a 100644
--- a/source3/rpc_parse/parse_samr.c
+++ b/source3/rpc_parse/parse_samr.c
@@ -1563,7 +1563,22 @@ static BOOL sam_io_sam_dispinfo_2(char *desc, SAM_DISPINFO_2 * sam,
if(!prs_align(ps))
return False;
- SMB_ASSERT_ARRAY(sam->sam, num_entries);
+ if (UNMARSHALLING(ps) && num_entries > 0) {
+
+ if ((sam->sam = (SAM_ENTRY2 *)
+ prs_alloc_mem(ps, sizeof(SAM_ENTRY2) *
+ num_entries)) == NULL) {
+ DEBUG(0, ("out of memory allocating SAM_ENTRY2\n"));
+ return False;
+ }
+
+ if ((sam->str = (SAM_STR2 *)
+ prs_alloc_mem(ps, sizeof(SAM_STR2) *
+ num_entries)) == NULL) {
+ DEBUG(0, ("out of memory allocating SAM_STR2\n"));
+ return False;
+ }
+ }
for (i = 0; i < num_entries; i++) {
if(!sam_io_sam_entry2("", &sam->sam[i], ps, depth))
@@ -1648,7 +1663,22 @@ static BOOL sam_io_sam_dispinfo_3(char *desc, SAM_DISPINFO_3 * sam,
if(!prs_align(ps))
return False;
- SMB_ASSERT_ARRAY(sam->sam, num_entries);
+ if (UNMARSHALLING(ps) && num_entries > 0) {
+
+ if ((sam->sam = (SAM_ENTRY3 *)
+ prs_alloc_mem(ps, sizeof(SAM_ENTRY3) *
+ num_entries)) == NULL) {
+ DEBUG(0, ("out of memory allocating SAM_ENTRY3\n"));
+ return False;
+ }
+
+ if ((sam->str = (SAM_STR3 *)
+ prs_alloc_mem(ps, sizeof(SAM_STR3) *
+ num_entries)) == NULL) {
+ DEBUG(0, ("out of memory allocating SAM_STR3\n"));
+ return False;
+ }
+ }
for (i = 0; i < num_entries; i++) {
if(!sam_io_sam_entry3("", &sam->sam[i], ps, depth))
@@ -1732,7 +1762,22 @@ static BOOL sam_io_sam_dispinfo_4(char *desc, SAM_DISPINFO_4 * sam,
if(!prs_align(ps))
return False;
- SMB_ASSERT_ARRAY(sam->sam, num_entries);
+ if (UNMARSHALLING(ps) && num_entries > 0) {
+
+ if ((sam->sam = (SAM_ENTRY4 *)
+ prs_alloc_mem(ps, sizeof(SAM_ENTRY4) *
+ num_entries)) == NULL) {
+ DEBUG(0, ("out of memory allocating SAM_ENTRY4\n"));
+ return False;
+ }
+
+ if ((sam->str = (SAM_STR4 *)
+ prs_alloc_mem(ps, sizeof(SAM_STR4) *
+ num_entries)) == NULL) {
+ DEBUG(0, ("out of memory allocating SAM_STR4\n"));
+ return False;
+ }
+ }
for (i = 0; i < num_entries; i++) {
if(!sam_io_sam_entry4("", &sam->sam[i], ps, depth))
@@ -1814,7 +1859,22 @@ static BOOL sam_io_sam_dispinfo_5(char *desc, SAM_DISPINFO_5 * sam,
if(!prs_align(ps))
return False;
- SMB_ASSERT_ARRAY(sam->sam, num_entries);
+ if (UNMARSHALLING(ps) && num_entries > 0) {
+
+ if ((sam->sam = (SAM_ENTRY5 *)
+ prs_alloc_mem(ps, sizeof(SAM_ENTRY5) *
+ num_entries)) == NULL) {
+ DEBUG(0, ("out of memory allocating SAM_ENTRY5\n"));
+ return False;
+ }
+
+ if ((sam->str = (SAM_STR5 *)
+ prs_alloc_mem(ps, sizeof(SAM_STR5) *
+ num_entries)) == NULL) {
+ DEBUG(0, ("out of memory allocating SAM_STR5\n"));
+ return False;
+ }
+ }
for (i = 0; i < num_entries; i++) {
if(!sam_io_sam_entry5("", &sam->sam[i], ps, depth))