diff options
author | Stefan Metzmacher <metze@samba.org> | 2010-02-19 08:11:24 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2010-02-19 08:12:42 +0100 |
commit | 76aa37f653fec2d511921768381db7da661750cb (patch) | |
tree | 724d3fa830b204fececc74d9c47f5e38a4533125 /librpc | |
parent | 809dd8c4137e8dcb52613067fea49357b71355fa (diff) | |
download | samba-76aa37f653fec2d511921768381db7da661750cb.tar.gz samba-76aa37f653fec2d511921768381db7da661750cb.tar.bz2 samba-76aa37f653fec2d511921768381db7da661750cb.zip |
librpc/ndr: don't overwrite the content in ndr_push_relative_ptr2_end()
metze
Diffstat (limited to 'librpc')
-rw-r--r-- | librpc/ndr/ndr.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c index b6110d52b4..4d763e0ead 100644 --- a/librpc/ndr/ndr.c +++ b/librpc/ndr/ndr.c @@ -1253,11 +1253,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 */ |