summaryrefslogtreecommitdiff
path: root/source4/librpc/ndr/ndr.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/librpc/ndr/ndr.c')
-rw-r--r--source4/librpc/ndr/ndr.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c
index 2e350aa0da..f3394d1e44 100644
--- a/source4/librpc/ndr/ndr.c
+++ b/source4/librpc/ndr/ndr.c
@@ -789,9 +789,12 @@ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push)
NTSTATUS status;
size_t ret;
+ /* avoid recursion */
+ if (flags & LIBNDR_FLAG_NO_NDR_SIZE) return 0;
+
ndr = ndr_push_init_ctx(NULL);
if (!ndr) return 0;
- ndr->flags |= flags;
+ ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
status = push(ndr, NDR_SCALARS|NDR_BUFFERS, discard_const(p));
if (!NT_STATUS_IS_OK(status)) {
return 0;
@@ -810,9 +813,12 @@ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_union_f
NTSTATUS status;
size_t ret;
+ /* avoid recursion */
+ if (flags & LIBNDR_FLAG_NO_NDR_SIZE) return 0;
+
ndr = ndr_push_init_ctx(NULL);
if (!ndr) return 0;
- ndr->flags |= flags;
+ ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
status = push(ndr, NDR_SCALARS|NDR_BUFFERS, level, discard_const(p));
if (!NT_STATUS_IS_OK(status)) {
return 0;