Skip to contentSkip to conversation

package/libzlib: upstream patch for CVE-2026-85091

PATCH Applied Thomas Perale via buildroot 1 participant 3 messages Oct 14 – Oct 23

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/libzlib: upstream patch for CVE-2026-85091

This fixes the following vulnerability:

- CVE-2026-85091:
zlib versions 1.3.1.2 through 1.3.2 contain a heap buffer overflow vulnerability in the gz_vacate() function when processing non-blocking gzwrite() operations with stale external buffer pointers. Attackers can trigger the overflow by calling gzprintf() or gzvprintf() after a write stall, causing an unchecked memmove() to write beyond the internal input buffer boundary.

For more information, see:
- https://www.cve.org/CVERecord?id=CVE-2026-85091
- https://security-tracker.debian.org/tracker/CVE-2026-85091
- https://github.com/madler/zlib/commit/df84af25dc1942490e1d1c899a07619152a46148.patch

---
 ...overflow-bug-in-non-blocking-gzwrite.patch | 31 +++++++++++++++++++
 package/libzlib/libzlib.mk                    |  2 ++
 2 files changed, 33 insertions(+)
 create mode 100644 package/libzlib/0001-fix-buffer-overflow-bug-in-non-blocking-gzwrite.patch
package/libzlib/0001-fix-buffer-overflow-bug-in-non-blocking-gzwrite.patch new file +31 -0
new file mode 100644
index 0000000000..32aaabcc76
@@ -0,0 +1,31 @@
+From df84af25dc1942490e1d1c899a07619152a46148 Mon Sep 17 00:00:00 2001
+From: Mark Adler <[email protected]>
+Date: Wed, 16 Sep 2026 16:26:14 -0700
+Subject: [PATCH] Fix buffer overflow bug in non-blocking gzwrite.
+
+This addresses CVE-2026-85091.
+
+Upstream: https://github.com/madler/zlib/commit/df84af25dc1942490e1d1c899a07619152a46148.patch
+CVE: CVE-2026-85091
+Signed-off-by: Thomas Perale <[email protected]>
+---
+ gzwrite.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/gzwrite.c b/gzwrite.c
+index b217b85ce..512329244 100644
+--- a/gzwrite.c
++++ b/gzwrite.c
+@@ -242,8 +242,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);
+     }
+ 
package/libzlib/libzlib.mk +2 -0
index d71d5d5233..9ce08d7093 100644
@@ -15,6 +15,8 @@ LIBZLIB_PROVIDES = zlib
 LIBZLIB_CPE_ID_VENDOR = zlib
 LIBZLIB_CPE_ID_PRODUCT = zlib
 
+LIBZLIB_IGNORE_CVES += CVE-2026-85091
+
 # It is not possible to build only a shared version of zlib, so we build both
 # shared and static, unless we only want the static libs, and we eventually
 # selectively remove what we do not want
Signature · 6 lines
2.56.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Am 14.10.26 um 08:58 schrieb Thomas Perale via buildroot:

Quoted 10 lines

This fixes the following vulnerability:

- CVE-2026-85091:
zlib versions 1.3.1.2 through 1.3.2 contain a heap buffer overflow vulnerability in the gz_vacate() function when processing non-blocking gzwrite() operations with stale external buffer pointers. Attackers can trigger the overflow by calling gzprintf() or gzvprintf() after a write stall, causing an unchecked memmove() to write beyond the internal input buffer boundary.

Quoted 6 lines

For more information, see:
- https://www.cve.org/CVERecord?id=CVE-2026-85091
- https://security-tracker.debian.org/tracker/CVE-2026-85091
- https://github.com/madler/zlib/commit/df84af25dc1942490e1d1c899a07619152a46148.patch

Applied to master, thank you!

Quoted 48 lines
---
  ...overflow-bug-in-non-blocking-gzwrite.patch | 31 +++++++++++++++++++
  package/libzlib/libzlib.mk                    |  2 ++
  2 files changed, 33 insertions(+)

create mode 100644 package/libzlib/0001-fix-buffer-overflow-bug-in-non-blocking-gzwrite.patch

package/libzlib/0001-fix-buffer-overflow-bug-in-non-blocking-gzwrite.patch new file +31 -0
new file mode 100644
index 0000000000..32aaabcc76
@@ -0,0 +1,31 @@
+From df84af25dc1942490e1d1c899a07619152a46148 Mon Sep 17 00:00:00 2001
+From: Mark Adler <[email protected]>
+Date: Wed, 16 Sep 2026 16:26:14 -0700
+Subject: [PATCH] Fix buffer overflow bug in non-blocking gzwrite.
+
+This addresses CVE-2026-85091.
+
+Upstream: https://github.com/madler/zlib/commit/df84af25dc1942490e1d1c899a07619152a46148.patch
+CVE: CVE-2026-85091
+Signed-off-by: Thomas Perale <[email protected]>
+---
+ gzwrite.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/gzwrite.c b/gzwrite.c
+index b217b85ce..512329244 100644
+--- a/gzwrite.c
++++ b/gzwrite.c
+@@ -242,8 +242,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);
+     }
+
package/libzlib/libzlib.mk +0 -0
index d71d5d5233..9ce08d7093 100644

package/libzlib/libzlib.mk LIBZLIB_PROVIDES = zlib · line 22

Quoted 8 lines
package/libzlib/libzlib.mk +2 -0
@@ -15,6 +15,8 @@ LIBZLIB_PROVIDES = zlib
  LIBZLIB_CPE_ID_VENDOR = zlib
  LIBZLIB_CPE_ID_PRODUCT = zlib
 
+LIBZLIB_IGNORE_CVES += CVE-2026-85091
+
  # It is not possible to build only a shared version of zlib, so we build both
  # shared and static, unless we only want the static libs, and we eventually
  # selectively remove what we do not want

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
In reply to Thomas Perale via buildroot

In reply of:

Quoted 10 lines

This fixes the following vulnerability:

- CVE-2026-85091:
zlib versions 1.3.1.2 through 1.3.2 contain a heap buffer overflow vulnerability in the gz_vacate() function when processing non-blocking gzwrite() operations with stale external buffer pointers. Attackers can trigger the overflow by calling gzprintf() or gzvprintf() after a write stall, causing an unchecked memmove() to write beyond the internal input buffer boundary.

Quoted 6 lines

For more information, see:
- https://www.cve.org/CVERecord?id=CVE-2026-85091
- https://security-tracker.debian.org/tracker/CVE-2026-85091
- https://github.com/madler/zlib/commit/df84af25dc1942490e1d1c899a07619152a46148.patch

Applied to 2025.02.x, 2026.08.x. Thanks

Quoted 48 lines
---
 ...overflow-bug-in-non-blocking-gzwrite.patch | 31 +++++++++++++++++++
 package/libzlib/libzlib.mk                    |  2 ++
 2 files changed, 33 insertions(+)
 create mode 100644 package/libzlib/0001-fix-buffer-overflow-bug-in-non-blocking-gzwrite.patch
package/libzlib/0001-fix-buffer-overflow-bug-in-non-blocking-gzwrite.patch new file +31 -0
new file mode 100644
index 0000000000..32aaabcc76
@@ -0,0 +1,31 @@
+From df84af25dc1942490e1d1c899a07619152a46148 Mon Sep 17 00:00:00 2001
+From: Mark Adler <[email protected]>
+Date: Wed, 16 Sep 2026 16:26:14 -0700
+Subject: [PATCH] Fix buffer overflow bug in non-blocking gzwrite.
+
+This addresses CVE-2026-85091.
+
+Upstream: https://github.com/madler/zlib/commit/df84af25dc1942490e1d1c899a07619152a46148.patch
+CVE: CVE-2026-85091
+Signed-off-by: Thomas Perale <[email protected]>
+---
+ gzwrite.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/gzwrite.c b/gzwrite.c
+index b217b85ce..512329244 100644
+--- a/gzwrite.c
++++ b/gzwrite.c
+@@ -242,8 +242,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);
+     }
+ 
package/libzlib/libzlib.mk +0 -0
index d71d5d5233..9ce08d7093 100644

package/libzlib/libzlib.mk LIBZLIB_PROVIDES = zlib · line 22

Quoted 8 lines
package/libzlib/libzlib.mk +2 -0
@@ -15,6 +15,8 @@ LIBZLIB_PROVIDES = zlib
 LIBZLIB_CPE_ID_VENDOR = zlib
 LIBZLIB_CPE_ID_PRODUCT = zlib
 
+LIBZLIB_IGNORE_CVES += CVE-2026-85091
+
 # It is not possible to build only a shared version of zlib, so we build both
 # shared and static, unless we only want the static libs, and we eventually
 # selectively remove what we do not want

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot