summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2013-02-01 17:44:16 +0100
committerGünther Deschner <gd@samba.org>2013-02-01 19:38:06 +0100
commit732e8ab64d3c082dd142e4cbf07ebaec54549216 (patch)
treeb2862b82574ce7415902ea5cdff4f59599f76fcb /librpc
parent009cf6e9ceaef91805a8a7573090d051f8f74a92 (diff)
downloadsamba-732e8ab64d3c082dd142e4cbf07ebaec54549216.tar.gz
samba-732e8ab64d3c082dd142e4cbf07ebaec54549216.tar.bz2
samba-732e8ab64d3c082dd142e4cbf07ebaec54549216.zip
ndrdump: make sure to deal with the highest relative pointer offset correctly.
Guenther Signed-off-by: Günther Deschner <gd@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'librpc')
-rw-r--r--librpc/tools/ndrdump.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/librpc/tools/ndrdump.c b/librpc/tools/ndrdump.c
index 91bf06fcd9..4a102f5269 100644
--- a/librpc/tools/ndrdump.c
+++ b/librpc/tools/ndrdump.c
@@ -214,6 +214,7 @@ static NTSTATUS ndrdump_pull_and_print_pipes(const char *function,
};
const struct ndr_interface_call_pipes *in_pipes = NULL;
const struct ndr_interface_call_pipes *out_pipes = NULL;
+ uint32_t highest_ofs;
ndr_table_init();
@@ -341,8 +342,14 @@ static NTSTATUS ndrdump_pull_and_print_pipes(const char *function,
ndr_err = f->ndr_pull(ndr_pull, NDR_IN, st);
- if (ndr_pull->offset != ndr_pull->data_size) {
- printf("WARNING! %d unread bytes while parsing context file\n", ndr_pull->data_size - ndr_pull->offset);
+ if (ndr_pull->offset > ndr_pull->relative_highest_offset) {
+ highest_ofs = ndr_pull->offset;
+ } else {
+ highest_ofs = ndr_pull->relative_highest_offset;
+ }
+
+ if (highest_ofs != ndr_pull->data_size) {
+ printf("WARNING! %d unread bytes while parsing context file\n", ndr_pull->data_size - highest_ofs);
}
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -392,10 +399,16 @@ static NTSTATUS ndrdump_pull_and_print_pipes(const char *function,
printf("pull returned %s\n", nt_errstr(status));
- if (ndr_pull->offset != ndr_pull->data_size) {
- printf("WARNING! %d unread bytes\n", ndr_pull->data_size - ndr_pull->offset);
- ndrdump_data(ndr_pull->data+ndr_pull->offset,
- ndr_pull->data_size - ndr_pull->offset,
+ if (ndr_pull->offset > ndr_pull->relative_highest_offset) {
+ highest_ofs = ndr_pull->offset;
+ } else {
+ highest_ofs = ndr_pull->relative_highest_offset;
+ }
+
+ if (highest_ofs != ndr_pull->data_size) {
+ printf("WARNING! %d unread bytes\n", ndr_pull->data_size - highest_ofs);
+ ndrdump_data(ndr_pull->data+highest_ofs,
+ ndr_pull->data_size - highest_ofs,
dumpdata);
}