From: tb Date: Tue, 15 Aug 2023 12:18:46 +0000 (+0000) Subject: Fix bug when using gzflush() with a very small buffer. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=cb4f93b0b373fb30800b379faf83e7f3d5d26f4c;p=openbsd Fix bug when using gzflush() with a very small buffer. from upstream --- diff --git a/lib/libz/gzlib.c b/lib/libz/gzlib.c index 2b446c448f0..29fc4486fba 100644 --- a/lib/libz/gzlib.c +++ b/lib/libz/gzlib.c @@ -308,8 +308,8 @@ int ZEXPORT gzbuffer(gzFile file, unsigned size) { /* check and set requested size */ if ((size << 1) < size) return -1; /* need to be able to double it */ - if (size < 2) - size = 2; /* need two bytes to check magic header */ + if (size < 8) + size = 8; /* needed to behave well with flushing */ state->want = size; return 0; }