summaryrefslogtreecommitdiff
path: root/lib/compression
diff options
context:
space:
mode:
authorJoseph Sutton <josephsutton@catalyst.net.nz>2022-03-08 12:11:51 +1300
committerAndrew Bartlett <abartlet@samba.org>2022-05-12 02:22:35 +0000
commit41b88d35ce6b120a1252093ea55ef80b7685e71e (patch)
tree1491063ce92fbd80ff7d9c4aedd245177de2e0e8 /lib/compression
parent0c813ee56377c51bf4be786633b863f85a5f540e (diff)
downloadsamba-41b88d35ce6b120a1252093ea55ef80b7685e71e.tar.gz
compression: Add bounds check for first output buffer write
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'lib/compression')
-rw-r--r--lib/compression/lzxpress.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/compression/lzxpress.c b/lib/compression/lzxpress.c
index 65feed0aa73..647545bbac3 100644
--- a/lib/compression/lzxpress.c
+++ b/lib/compression/lzxpress.c
@@ -73,9 +73,11 @@ ssize_t lzxpress_compress(const uint8_t *uncompressed,
}
uncompressed_pos = 0;
+ compressed_pos = 0;
indic = 0;
+ CHECK_OUTPUT_BYTES(sizeof(uint32_t));
*(uint32_t *)compressed = 0;
- compressed_pos = sizeof(uint32_t);
+ compressed_pos += sizeof(uint32_t);
indic_pos = 0;
indic_bit = 0;