MFV: zlib: Fix buffer overflow bug in non-blocking gzwrite.

MFC after:	3 days
DIfferential revision:	https://reviews.freebsd.org/D60695
This commit is contained in:
Xin LI committed 2026-10-12 22:49:35 -07:00
commit 7fe1d8abad
1 file changed
+4 -1
+4 -1
View File
@@ -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);
}