summaryrefslogtreecommitdiffstats
path: root/librpc/ndr
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-09-21 22:30:25 +0200
committerGünther Deschner <gd@samba.org>2014-02-11 16:02:14 +0100
commitef5e0b7339ace6d5bf4771d196f8868171c02103 (patch)
treee50512b7a254a1625d15b66f55a718d1660acd09 /librpc/ndr
parente2a621466e740cc7fc2a659163f8895287c9a01e (diff)
downloadsamba-ef5e0b7339ace6d5bf4771d196f8868171c02103.tar.gz
samba-ef5e0b7339ace6d5bf4771d196f8868171c02103.tar.xz
samba-ef5e0b7339ace6d5bf4771d196f8868171c02103.zip
librpc/ndr: remember INCOMPLETE_BUFFER missing bytes in relative_highest_offset
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'librpc/ndr')
-rw-r--r--librpc/ndr/libndr.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
index bc843c12e27..f52038eb3b8 100644
--- a/librpc/ndr/libndr.h
+++ b/librpc/ndr/libndr.h
@@ -274,6 +274,11 @@ enum ndr_compression_alg {
#define NDR_PULL_NEED_BYTES(ndr, n) do { \
if (unlikely((n) > ndr->data_size || ndr->offset + (n) > ndr->data_size)) { \
+ if (ndr->flags & LIBNDR_FLAG_INCOMPLETE_BUFFER) { \
+ uint32_t _available = ndr->data_size - ndr->offset; \
+ uint32_t _missing = n - _available; \
+ ndr->relative_highest_offset = _missing; \
+ } \
return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, "Pull bytes %u (%s)", (unsigned)n, __location__); \
} \
} while(0)
@@ -290,6 +295,10 @@ enum ndr_compression_alg {
ndr->offset = (ndr->offset + (n-1)) & ~(n-1); \
} \
if (unlikely(ndr->offset > ndr->data_size)) { \
+ if (ndr->flags & LIBNDR_FLAG_INCOMPLETE_BUFFER) { \
+ uint32_t _missing = ndr->offset - ndr->data_size; \
+ ndr->relative_highest_offset = _missing; \
+ } \
return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, "Pull align %u", (unsigned)n); \
} \
} while(0)