aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adler <fork@madler.net>2022-07-30 22:51:11 +0000
committerEd Maste <emaste@FreeBSD.org>2023-01-24 22:27:50 +0000
commite59d10aff6edc088850be553252020230a560514 (patch)
tree10895cfee849e38681ec3f4b493ba412fdb85253
parent9597624d82c7ebd845c11bf4c7e27d6bbf42dd96 (diff)
-rw-r--r--sys/contrib/zlib/inflate.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/contrib/zlib/inflate.c b/sys/contrib/zlib/inflate.c
index ac333e8c2eda..cd018573dee8 100644
--- a/sys/contrib/zlib/inflate.c
+++ b/sys/contrib/zlib/inflate.c
@@ -759,8 +759,9 @@ int flush;
if (copy > have) copy = have;
if (copy) {
if (state->head != Z_NULL &&
- state->head->extra != Z_NULL) {
- len = state->head->extra_len - state->length;
+ state->head->extra != Z_NULL &&
+ (len = state->head->extra_len - state->length) <
+ state->head->extra_max) {
zmemcpy(state->head->extra + len, next,
len + copy > state->head->extra_max ?
state->head->extra_max - len : copy);