From 0739d3dafdbc43f4c8f8adc2d2a216b7486971f1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 21 Nov 2003 22:00:00 +0000 Subject: cleaner handling of relative pointers to strings (This used to be commit 4022e710755a61a3439f739a78fa6965b9b7788e) --- source4/librpc/ndr/ndr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/librpc') diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index dcd0066083..b67fb25b1e 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -555,9 +555,9 @@ NTSTATUS ndr_pull_relative(struct ndr_pull *ndr, const void **buf, size_t size, ndr_pull_save(ndr, &save); NDR_CHECK(ndr_pull_set_offset(ndr, ofs + ndr->ofs_list->offset)); NDR_CHECK(ndr_pull_subcontext(ndr, &ndr2, ndr->data_size - ndr->offset)); - if (size == 1) { - /* oh what a hack! */ - NDR_CHECK(fn(&ndr2, NDR_SCALARS|NDR_BUFFERS, (void *)&p)); + /* strings must be allocated by the backend functions */ + if (ndr->flags & LIBNDR_STRING_FLAGS) { + NDR_CHECK(fn(&ndr2, NDR_SCALARS|NDR_BUFFERS, &p)); } else { NDR_ALLOC_SIZE(ndr, p, size); NDR_CHECK(fn(&ndr2, NDR_SCALARS|NDR_BUFFERS, p)); -- cgit