diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-04-04 14:25:29 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:11:24 -0500 |
commit | 051206ff1eef474e7929e8fca85b161d5306c6b8 (patch) | |
tree | 021794695ad9eeecd17311045973a8e87525f3a3 /source4/librpc | |
parent | 638104dd4c429165f0eb3c332e4915372630a0ac (diff) | |
download | samba-051206ff1eef474e7929e8fca85b161d5306c6b8.tar.gz samba-051206ff1eef474e7929e8fca85b161d5306c6b8.tar.bz2 samba-051206ff1eef474e7929e8fca85b161d5306c6b8.zip |
r6191: fix spoolss_Enum* push code
metze
(This used to be commit e66aa87f148d04f4c44b08555345600b8a6278d4)
Diffstat (limited to 'source4/librpc')
-rw-r--r-- | source4/librpc/ndr/ndr_spoolss_buf.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source4/librpc/ndr/ndr_spoolss_buf.c b/source4/librpc/ndr/ndr_spoolss_buf.c index 2bc55db758..de4a87547d 100644 --- a/source4/librpc/ndr/ndr_spoolss_buf.c +++ b/source4/librpc/ndr/ndr_spoolss_buf.c @@ -29,6 +29,8 @@ DATA_BLOB buffer;\ if (r->out.info) {\ int i;\ + size_t size;\ + uint8_t *data;\ struct ndr_push *ndr2;\ \ ndr2 = ndr_push_init_ctx(ndr);\ @@ -36,20 +38,24 @@ return NT_STATUS_NO_MEMORY;\ }\ \ + size = ndr2->offset;\ + data = ndr2->data;\ +\ for (i=0;i<r->out.count;i++) {\ ndr2->data += ndr2->offset;\ ndr2->offset = 0;\ NDR_CHECK(ndr_push_set_switch_value(ndr2, &(*r->out.info)[i], r->in.level)); \ NDR_CHECK(ndr_push_##type(ndr2, NDR_SCALARS|NDR_BUFFERS, &(*r->out.info)[i]));\ + size += ndr2->offset;\ }\ - if (*r->in.buf_size >= ndr2->offset) {\ - buffer = data_blob_const(ndr2->data, ndr2->offset);\ + if (*r->in.buf_size >= size) {\ + buffer = data_blob_const(data, size);\ } else {\ r->out.info = NULL;\ r->out.count = 0;\ r->out.result = WERR_INSUFFICIENT_BUFFER;\ }\ - *r->out.buf_size = ndr2->offset;\ + *r->out.buf_size = size;\ }\ NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info));\ if (r->out.info) {\ |