From 4be369984895ffb5afc5bf9d56ef19d944513eb3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 28 Feb 2006 04:02:26 +0000 Subject: r13741: make the pointer type in pidl handle any size pointer, just in case we have a 128 bit machine out there somewhere (This used to be commit 4a1b7580a7ea5db7d10c8ee6a5b3950313b7d273) --- source4/librpc/ndr/ndr_basic.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'source4/librpc/ndr') diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c index 8020c7da23..ccc1c8a016 100644 --- a/source4/librpc/ndr/ndr_basic.c +++ b/source4/librpc/ndr/ndr_basic.c @@ -197,12 +197,13 @@ NTSTATUS ndr_pull_hyper(struct ndr_pull *ndr, int ndr_flags, uint64_t *v) */ NTSTATUS ndr_pull_pointer(struct ndr_pull *ndr, int ndr_flags, void* *v) { - uint64_t h; - NTSTATUS status; - NDR_PULL_ALIGN(ndr, 8); - status = ndr_pull_udlong(ndr, ndr_flags, &h); - *v = (void *)((intptr_t)h); - return status; + intptr_t h; + NDR_PULL_ALIGN(ndr, sizeof(h)); + NDR_PULL_NEED_BYTES(ndr, sizeof(h)); + memcpy(&h, ndr->data+ndr->offset, sizeof(h)); + ndr->offset += sizeof(h); + *v = (void *)h; + return NT_STATUS_OK; } /* @@ -393,8 +394,12 @@ NTSTATUS ndr_push_hyper(struct ndr_push *ndr, int ndr_flags, uint64_t v) */ NTSTATUS ndr_push_pointer(struct ndr_push *ndr, int ndr_flags, void* v) { - NDR_PUSH_ALIGN(ndr, 8); - return ndr_push_udlong(ndr, NDR_SCALARS, (intptr_t)v); + intptr_t h = (intptr_t)v; + NDR_PUSH_ALIGN(ndr, sizeof(h)); + NDR_PUSH_NEED_BYTES(ndr, sizeof(h)); + memcpy(ndr->data+ndr->offset, &h, sizeof(h)); + ndr->offset += sizeof(h); + return NT_STATUS_OK; } NTSTATUS ndr_push_align(struct ndr_push *ndr, size_t size) -- cgit