1
0
mirror of https://git.yoctoproject.org/poky synced 2026-08-30 00:26:36 +00:00

gzip: Fix CVE-2026-41991

This patch applies the upstream fix for CVE-2026-41991 as referenced
in [2], using the upstream commit identified in [1].

[1] https://cgit.git.savannah.gnu.org/cgit/gzip.git/commit/?id=4e6f8b24ab823146ab8776f0b7fe486ab34d4269
[2] https://nvd.nist.gov/vuln/detail/CVE-2026-41991

(From OE-Core rev: 756270e9b67b97b276729daba50febe7093d85b3)

Signed-off-by: Darsh Kelaiya <dkelaiya@cisco.com>
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Paul Barker <paul@pbarker.dev>
This commit is contained in:
Darsh Kelaiya
2026-07-16 04:54:15 -07:00
committed by Paul Barker
parent 11fbd90126
commit 6dacef99fb
2 changed files with 76 additions and 0 deletions
@@ -0,0 +1,75 @@
From 0af3a96047fe02690473d4e106c39552e0c1285e Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 16 Apr 2026 12:11:44 -0700
Subject: [PATCH] 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.
CVE: CVE-2026-41991
Upstream-Status: Backport [https://cgit.git.savannah.gnu.org/cgit/gzip.git/commit/?id=4e6f8b24ab823146ab8776f0b7fe486ab34d4269]
(cherry picked from commit 4e6f8b24ab823146ab8776f0b7fe486ab34d4269)
Signed-off-by: Darsh Kelaiya <dkelaiya@cisco.com>
---
NEWS | 5 +++++
gzexe.in | 1 +
zdiff.in | 7 +++----
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/NEWS b/NEWS
index 6a20892..c643b2f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,10 @@
GNU gzip NEWS -*- outline -*-
+ On old-fashioned or limited platforms lacking mktemp, gzexe and
+ zdiff no longer have a race when creating a temporary file.
+ [bug present since the beginning]
+
+
* Noteworthy changes in release 1.13 (2023-08-19) [stable]
** Changes in behavior
diff --git a/gzexe.in b/gzexe.in
index 5e3d4c2..f31b9c8 100644
--- a/gzexe.in
+++ b/gzexe.in
@@ -128,6 +128,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 e35e6fe..bbcc75b 100644
--- a/zdiff.in
+++ b/zdiff.in
@@ -157,12 +157,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 -- "$file2" > "$tmp" || exit 2
gzip_status=$(
exec 4>&1
--
2.44.4
+1
View File
@@ -7,6 +7,7 @@ LICENSE = "GPL-3.0-or-later"
SRC_URI = "${GNU_MIRROR}/gzip/${BP}.tar.gz \
file://run-ptest \
file://CVE-2026-41992.patch \
file://CVE-2026-41991.patch \
"
SRC_URI:append:class-target = " file://wrong-path-fix.patch"