svn commit: samba r5736 - in branches/SAMBA_4_0/source/librpc/ndr: .

metze at samba.org metze at samba.org
Fri Mar 11 10:09:17 GMT 2005


Author: metze
Date: 2005-03-11 10:09:16 +0000 (Fri, 11 Mar 2005)
New Revision: 5736

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5736

Log:
fix to avoid endless recursion in ndr_size_*() calculation

metze

Modified:
   branches/SAMBA_4_0/source/librpc/ndr/libndr.h
   branches/SAMBA_4_0/source/librpc/ndr/ndr.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/ndr/libndr.h
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/libndr.h	2005-03-10 23:41:19 UTC (rev 5735)
+++ branches/SAMBA_4_0/source/librpc/ndr/libndr.h	2005-03-11 10:09:16 UTC (rev 5736)
@@ -132,6 +132,9 @@
 /* set if an object uuid will be present */
 #define LIBNDR_FLAG_OBJECT_PRESENT    (1<<30)
 
+/* set to avoid recursion in ndr_size_*() calculation */
+#define LIBNDR_FLAG_NO_NDR_SIZE		(1<<31)
+
 /* useful macro for debugging */
 #define NDR_PRINT_DEBUG(type, p) ndr_print_debug((ndr_print_fn_t)ndr_print_ ##type, #p, p)
 #define NDR_PRINT_UNION_DEBUG(type, level, p) ndr_print_union_debug((ndr_print_union_fn_t)ndr_print_ ##type, #p, level, p)

Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/ndr.c	2005-03-10 23:41:19 UTC (rev 5735)
+++ branches/SAMBA_4_0/source/librpc/ndr/ndr.c	2005-03-11 10:09:16 UTC (rev 5736)
@@ -789,9 +789,12 @@
 	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 @@
 	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;



More information about the samba-cvs mailing list