From 7c20a87097f506215423ea7494956fd1d993e36d Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 21 Jun 2017 17:01:43 +0200 Subject: [PATCH] librpc/ndr: Use correct value for max compression size Signed-off-by: Andreas Schneider Reviewed-by: Guenther Deschner Reviewed-by: Jeremy Allison --- librpc/ndr/ndr_compression.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/librpc/ndr/ndr_compression.c b/librpc/ndr/ndr_compression.c index 41328ea499cf..f6185b2ac86c 100644 --- a/librpc/ndr/ndr_compression.c +++ b/librpc/ndr/ndr_compression.c @@ -175,7 +175,11 @@ static enum ndr_err_code ndr_push_compression_mszip_chunk(struct ndr_push *ndrpu uint32_t plain_chunk_size; uint32_t plain_chunk_offset; uint32_t max_plain_size = 0x00008000; - uint32_t max_comp_size = 0x00008000 + 2 + 12 /*TODO: what value do we really need here?*/; + /* + * The maximum compressed size of each MSZIP block is 32k + 12 bytes + * header size. + */ + uint32_t max_comp_size = 0x00008000 + 12; uint32_t tmp_offset; int z_ret; @@ -208,7 +212,7 @@ static enum ndr_err_code ndr_push_compression_mszip_chunk(struct ndr_push *ndrpu z->total_in = 0; z->next_out = comp_chunk.data + 2; - z->avail_out = comp_chunk.length - 2; + z->avail_out = comp_chunk.length; z->total_out = 0; if (!z->opaque) { -- 2.34.1