Fix CVE-2026-41991 and CVE-2026-41992

Resolves: RHEL-215647
Resolves: RHEL-233021
This commit is contained in:
Jakub Martisko 2026-08-14 14:32:48 +02:00
parent f652b8d2d6
commit ebaa58e2b0
3 changed files with 104 additions and 2 deletions

54
CVE-2026-41991.patch Normal file
View File

@ -0,0 +1,54 @@
From 4e6f8b24ab823146ab8776f0b7fe486ab34d4269 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 16 Apr 2026 12:11:44 -0700
Subject: gzexe: use -C if lacking mktemp
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
(Problem reported by Michał Majchrowicz.)
* gzexe.in: If mktemp is needed but not installed,
use set -C to avoid a race when creating a temporary file.
* zdiff.in: Use the same pattern here, even though the old
code was probably OK anyway.
---
NEWS | 5 +++++
gzexe.in | 1 +
zdiff.in | 7 +++----
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/gzexe.in b/gzexe.in
index ea4ef94..f3d46cc 100644
--- a/gzexe.in
+++ b/gzexe.in
@@ -127,6 +127,7 @@ for i do
tmp=`mktemp "${dir}gzexeXXXXXXXXX"`
else
tmp=${dir}gzexe$$
+ (umask 77; set -C; > "$tmp")
fi && { cp -p "$file" "$tmp" 2>/dev/null || cp "$file" "$tmp"; } || {
res=$?
printf >&2 '%s\n' "$0: cannot copy $file"
diff --git a/zdiff.in b/zdiff.in
index 289e466..53266df 100644
--- a/zdiff.in
+++ b/zdiff.in
@@ -156,12 +156,11 @@ case $file2 in
*) TMPDIR=/tmp/;;
esac
if type mktemp >/dev/null 2>&1; then
- tmp=`mktemp "${TMPDIR}zdiffXXXXXXXXX"` ||
- exit 2
+ tmp=`mktemp "${TMPDIR}zdiffXXXXXXXXX"`
else
- set -C
tmp=${TMPDIR}zdiff$$
- fi
+ (umask 77; set -C; > "$tmp")
+ fi &&
gzip -cdfq -- "$2" > "$tmp" || exit 2
gzip_status=$(
exec 4>&1
--
cgit v1.2.3

36
CVE-2026-41992.patch Normal file
View File

@ -0,0 +1,36 @@
From 63dbf6b3b9e6e781df1a6a64e609b10e23969681 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Wed, 15 Apr 2026 12:00:17 -0700
Subject: gzip: dont mishandle .lzh after .Z
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Problem reported by Michał Majchrowicz.
* unlzh.c (read_c_len): Clear left and right when n == 0.
---
NEWS | 4 ++++
THANKS | 1 +
unlzh.c | 6 ++++++
3 files changed, 11 insertions(+)
diff --git a/unlzh.c b/unlzh.c
index 3320196..a6cf109 100644
--- a/unlzh.c
+++ b/unlzh.c
@@ -232,6 +232,12 @@ read_c_len ()
c = getbits(CBIT);
for (i = 0; i < NC; i++) c_len[i] = 0;
for (i = 0; i < 4096; i++) c_table[i] = c;
+
+ /* Needed in case LEFT and RIGHT are reused from a previous
+ LZW decompression. It may be overkill to clear all of both
+ arrays, but nobody has had time to analyze this carefully. */
+ memzero(left, (2 * NC - 1) * sizeof *left);
+ memzero(right, (2 * NC - 1) * sizeof *left);
} else {
i = 0;
while (i < n) {
--
cgit v1.3

View File

@ -1,7 +1,7 @@
Summary: The GNU data compression program
Name: gzip
Version: 1.9
Release: 13%{?dist}
Release: 14%{?dist}
# info pages are under GFDL license
License: GPLv3+ and GFDL
Group: Applications/File
@ -28,6 +28,11 @@ Patch9: cve-2022-1271-part1.patch
Patch10: cve-2022-1271-part2.patch
Patch11: cve-2022-1271-part3.patch
#https://cgit.git.savannah.gnu.org/cgit/gzip.git/commit/?id=4e6f8b24ab823146ab8776f0b7fe486ab34d4269
Patch12: CVE-2026-41991.patch
#https://cgit.git.savannah.gnu.org/cgit/gzip.git/commit/?id=63dbf6b3b9e6e781df1a6a64e609b10e23969681
Patch13: CVE-2026-41992.patch
# Fixed in upstream code.
# http://thread.gmane.org/gmane.comp.gnu.gzip.bugs/378
URL: http://www.gzip.org/
@ -58,13 +63,14 @@ very commonly used data compression program.
%patch2 -p1 -b .gzexe
%patch3 -p1 -b .ibm
%patch4 -p1 -b .ibm2
#%patch5 -p1 -b .ibm3
%patch6 -p1 -b .ibm4
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
cp %{SOURCE1} .
autoreconf
@ -126,6 +132,12 @@ fi
%{profiledir}/*
%changelog
* Tue Apr 19 2022 Jakub Martisko <jamartis@redhat.com> - 1.9-14
- Fix an issue with a temporary file creations when mktemp is missing (41991)
- Fix a global buffer overflow vulnerability in the LZH decompression logic (41992)
Resolves: CVE-2026-41991
Resolves: CVE-2026-41992
* Tue Apr 19 2022 Jakub Martisko <jamartis@redhat.com> - 1.9-13
- fix an arbitrary-file-write vulnerability in zgrep
Resolves: CVE-2022-1271