summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-02-19 08:11:24 +0100
committerKarolin Seeger <kseeger@samba.org>2010-02-22 15:50:39 +0100
commitce2cc2a615b684cd997fb970ba3eea72c943d921 (patch)
tree106d0183a41cb67c60eac9e16adea37a61b41298
parent8f0bf2747e3b711931d968c0f5004d99bb5b05e3 (diff)
downloadsamba-ce2cc2a615b684cd997fb970ba3eea72c943d921.tar.gz
samba-ce2cc2a615b684cd997fb970ba3eea72c943d921.tar.xz
samba-ce2cc2a615b684cd997fb970ba3eea72c943d921.zip
librpc/ndr: don't overwrite the content in ndr_push_relative_ptr2_end()
metze (cherry picked from commit 76aa37f653fec2d511921768381db7da661750cb) The last 25 patches address bug #6888 (REGRESSION: printing support for 64 bit windows clients broken). (cherry picked from commit 58b089f2176e564bf5563fbffa034cd22525ed6e)
-rw-r--r--librpc/ndr/ndr.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c
index ab4168a0f94..7d91d23eb81 100644
--- a/librpc/ndr/ndr.c
+++ b/librpc/ndr/ndr.c
@@ -1171,11 +1171,17 @@ _PUBLIC_ enum ndr_err_code ndr_push_relative_ptr2_end(struct ndr_push *ndr, cons
}
if (len > 0) {
+ uint32_t clear_size = correct_offset - begin_offset;
+
+ clear_size = MIN(clear_size, len);
+
/* now move the marshalled buffer to the end of the main buffer */
memmove(ndr->data + correct_offset, ndr->data + begin_offset, len);
- /* and wipe out old buffer within the main buffer */
- memset(ndr->data + begin_offset, '\0', len);
+ if (clear_size) {
+ /* and wipe out old buffer within the main buffer */
+ memset(ndr->data + begin_offset, '\0', clear_size);
+ }
}
/* and set the end offset for the next buffer */