From 3cd56afbfcffca5f9b7ac19a8b2612411b1d3a2d Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 25 Jun 2021 15:15:05 +0200 Subject: libfstream: sanity check the buffer size in the gzip stream compressor Signed-off-by: David Oberhollenzer --- lib/fstream/compress/gzip.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/fstream/compress/gzip.c b/lib/fstream/compress/gzip.c index e69f183..b73a258 100644 --- a/lib/fstream/compress/gzip.c +++ b/lib/fstream/compress/gzip.c @@ -20,6 +20,9 @@ static int flush_inbuf(ostream_comp_t *base, bool finish) size_t have; int ret; + if (base->inbuf_used > sizeof(base->inbuf)) + base->inbuf_used = sizeof(base->inbuf); + if (sizeof(size_t) > sizeof(uInt)) { gzip->strm.avail_in = ~((uInt)0); -- cgit v1.2.3