libndr: fix ndr_size_* calculation with relative reverse buffers
authorStefan Metzmacher <metze@samba.org>
Thu, 18 Feb 2010 14:13:20 +0000 (15:13 +0100)
committerKarolin Seeger <kseeger@samba.org>
Fri, 19 Feb 2010 13:32:31 +0000 (14:32 +0100)
metze
(cherry picked from commit 8310f02414efd3b792857ed20c636c4c114e1ba2)
(cherry picked from commit 2d157eac5abcfe75968d80978c82d6b7b2b0359b)

librpc/ndr/ndr.c

index da02682213d69d2e85643827c0ec02bd6f05fd7c..bece6b94e17fc63834fedef787849c031b68fb6b 100644 (file)
@@ -1136,6 +1136,12 @@ _PUBLIC_ enum ndr_err_code ndr_push_relative_ptr2_end(struct ndr_push *ndr, cons
                return NDR_ERR_SUCCESS;
        }
 
+       if (ndr->flags & LIBNDR_FLAG_NO_NDR_SIZE) {
+               /* better say more than calculation a too small buffer */
+               NDR_PUSH_ALIGN(ndr, 8);
+               return NDR_ERR_SUCCESS;
+       }
+
        if (ndr->relative_end_offset < ndr->offset) {
                return ndr_push_error(ndr, NDR_ERR_RELATIVE,
                                      "ndr_push_relative_ptr2_end:"