git: 03d26200a599 - stable/15 - MFC: MFV: zlib: Fix buffer overflow bug in non-blocking gzwrite.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 16 Oct 2026 03:45:09 UTC
The branch stable/15 has been updated by delphij:
URL: https://cgit.FreeBSD.org/src/commit/?id=03d26200a599dfab5dfe4a1b5f1d2356d6210ef7
commit 03d26200a599dfab5dfe4a1b5f1d2356d6210ef7
Author: Xin LI <delphij@FreeBSD.org>
AuthorDate: 2026-10-13 05:49:35 +0000
Commit: Xin LI <delphij@FreeBSD.org>
CommitDate: 2026-10-16 03:44:46 +0000
MFC: MFV: zlib: Fix buffer overflow bug in non-blocking gzwrite.
DIfferential revision: https://reviews.freebsd.org/D60695
(cherry picked from commit 7fe1d8abad3f55f127634c1ada7718bc1982089e)
---
sys/contrib/zlib/gzwrite.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sys/contrib/zlib/gzwrite.c b/sys/contrib/zlib/gzwrite.c
index b0da973cc016..f2fefb94346c 100644
--- a/sys/contrib/zlib/gzwrite.c
+++ b/sys/contrib/zlib/gzwrite.c
@@ -243,8 +243,11 @@ local z_size_t gz_write(gz_statep state, voidpc buf, z_size_t len) {
n -= state->strm.avail_in;
state->x.pos += n;
len -= n;
- if (ret == -1)
+ if (ret == -1) {
+ state->strm.avail_in = 0;
+ state->strm.next_in = state->in;
return state->again ? put - len : 0;
+ }
} while (len);
}