summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-06-25 15:15:05 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-06-25 15:15:05 +0200
commit3cd56afbfcffca5f9b7ac19a8b2612411b1d3a2d (patch)
treed1b7bf98715c33585b9ef93072b0327ccdc3b4ce /lib
parent9e345a9846270822d61dd232ec4cc6ca2558a782 (diff)
libfstream: sanity check the buffer size in the gzip stream compressor
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/fstream/compress/gzip.c3
1 files changed, 3 insertions, 0 deletions
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);