svn commit: lorikeet r187 - in trunk/ethereal/plugins/pidl: .
tpot at samba.org
tpot at samba.org
Tue Jan 18 06:50:47 GMT 2005
Author: tpot
Date: 2005-01-18 06:50:47 +0000 (Tue, 18 Jan 2005)
New Revision: 187
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=lorikeet&rev=187
Log:
Handle arrays of structures that contain buffers properly.
Modified:
trunk/ethereal/plugins/pidl/eparser.c
Changeset:
Modified: trunk/ethereal/plugins/pidl/eparser.c
===================================================================
--- trunk/ethereal/plugins/pidl/eparser.c 2005-01-18 05:33:05 UTC (rev 186)
+++ trunk/ethereal/plugins/pidl/eparser.c 2005-01-18 06:50:47 UTC (rev 187)
@@ -432,41 +432,39 @@
NTSTATUS (*pull_fn)(struct pidl_pull *, int,
pidl_tree *tree, void *))
{
- pidl_tree *subtrees;
- char *p = base;
+ char *p = base, buf[255];
uint32_t i;
- subtrees = (pidl_tree *)g_malloc(sizeof(pidl_tree) * count);
- memset(subtrees, 0, sizeof(pidl_tree) * count);
-
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+
for (i=0;i<count;i++) {
- proto_item *item;
- item = proto_tree_add_text(tree->proto_tree, ndr->tvb, ndr->offset, 0, "Array entry %d", i + 1);
- subtrees[i].proto_tree = proto_item_add_subtree(item, ett_array);
- if ((ndr_flags & (NDR_SCALARS|NDR_BUFFERS)) == (NDR_SCALARS|NDR_BUFFERS))
- pull_fn(ndr, NDR_SCALARS, &subtrees[i], p);
- else
- pull_fn(ndr, NDR_SCALARS, tree, p);
+ snprintf(buf, sizeof(buf) - 1, "Array element %d", i + 1);
+ buf[sizeof(buf) - 1] = 0;
- p += elsize;
+ pull_fn(ndr, NDR_SCALARS,
+ get_subtree(tree, buf, ndr, ett_array), p);
+ p += elsize;
}
+
if (!(ndr_flags & NDR_BUFFERS)) goto done;
+
buffers:
p = base;
+
for (i=0;i<count;i++) {
- if ((ndr_flags & (NDR_SCALARS|NDR_BUFFERS)) == (NDR_SCALARS|NDR_BUFFERS))
- pull_fn(ndr, NDR_BUFFERS, &subtrees[i], p);
- else
- pull_fn(ndr, NDR_BUFFERS, tree, p);
+ snprintf(buf, sizeof(buf) - 1, "Array element %d", i + 1);
+ buf[sizeof(buf) - 1] = 0;
+
+ pull_fn(ndr, NDR_BUFFERS,
+ get_subtree(tree, buf, ndr, ett_array), p);
+
p += elsize;
}
- done:
- g_free(subtrees);
+done:
return NT_STATUS_OK;
}
More information about the samba-cvs
mailing list