summaryrefslogtreecommitdiff
path: root/lib/libz
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2020-04-18 17:11:38 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2020-04-18 17:11:38 +0000
commitf64e275290fb7eab343a908b442b5fe633c83ed8 (patch)
tree8175bfdb4a9e1ac1f55046f1ba96f89b8d41f453 /lib/libz
parentc7e12e2aa2a616dae10e591b68a0505f1b7ec336 (diff)
When opening a completely empty file with gzopen(3), treat it as an
uncompressed file, such that the first gzread(3) results in Z_STREAM_END rather than in the misleading Z_BUF_ERROR. I checked that none of the many copies of libz in our tree suffer from the same bug, after deraadt@ asked. Bugfix patch from Olivier Taibi <oli at olitb dot net> on bugs@. OK millert@.
Diffstat (limited to 'lib/libz')
-rw-r--r--lib/libz/gzio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libz/gzio.c b/lib/libz/gzio.c
index 9df9e423f41..ab77ad9be19 100644
--- a/lib/libz/gzio.c
+++ b/lib/libz/gzio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gzio.c,v 1.14 2005/07/20 15:56:41 millert Exp $ */
+/* $OpenBSD: gzio.c,v 1.15 2020/04/18 17:11:37 schwarze Exp $ */
/* gzio.c -- IO on .gz files
* Copyright (C) 1995-2005 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
@@ -307,7 +307,7 @@ local void check_header(s)
s->stream.avail_in += len;
s->stream.next_in = s->inbuf;
if (s->stream.avail_in < 2) {
- s->transparent = s->stream.avail_in;
+ s->transparent = 1;
return;
}
}