mirror of
https://git.yoctoproject.org/poky
synced 2026-08-20 00:49:34 +02:00
gawk: Fix CVE-2026-40553
This patch applies the upstream fix as referenced in [3], using the commit shown in [1]. It also applies the corrective follow-up [2], which fixes the snprintf() truncation boundary check. Both commits are included in gawk 5.4.1, identified as the fixed release in [4]. [1] https://cgit.git.savannah.gnu.org/cgit/gawk.git/commit/?id=cca0366144336b49aaa7d5d949966ce8e2c70843 [2] https://cgit.git.savannah.gnu.org/cgit/gawk.git/commit/?id=bfa2e4b890a44100a99d26b54af385479528b12e [3] https://nvd.nist.gov/vuln/detail/CVE-2026-40553 [4] https://cert.pl/en/posts/2026/07/CVE-2026-40467/ (From OE-Core rev: 1f60829da0b2ea7d9f3295ba3cfd3bba972872a2) Signed-off-by: Darsh Kelaiya <dkelaiya@cisco.com> Reviewed-by: Leonid Iziumtsev <leonid.iziumtsev@est.tech> Signed-off-by: Yoann Congal <yoann.congal@smile.fr> Signed-off-by: Paul Barker <paul@pbarker.dev>
This commit is contained in:
committed by
Paul Barker
parent
5cd9ed667f
commit
cb5f298597
50
meta/recipes-extended/gawk/gawk/CVE-2026-40553_p1.patch
Normal file
50
meta/recipes-extended/gawk/gawk/CVE-2026-40553_p1.patch
Normal file
@@ -0,0 +1,50 @@
|
||||
From aa39cac4bda6333be0f6253ecb7dfade26cb9641 Mon Sep 17 00:00:00 2001
|
||||
From: "Arnold D. Robbins" <arnold@skeeve.com>
|
||||
Date: Wed, 15 Apr 2026 09:39:02 +0300
|
||||
Subject: [PATCH] Avoid buffer overflow in extension/readdir.c.
|
||||
|
||||
CVE: CVE-2026-40553
|
||||
Upstream-Status: Backport [https://cgit.git.savannah.gnu.org/cgit/gawk.git/commit/?id=cca0366144336b49aaa7d5d949966ce8e2c70843]
|
||||
|
||||
(cherry picked from commit cca0366144336b49aaa7d5d949966ce8e2c70843)
|
||||
Signed-off-by: Darsh Kelaiya <dkelaiya@cisco.com>
|
||||
---
|
||||
extension/ChangeLog | 6 ++++++
|
||||
extension/readdir.c | 6 +++++-
|
||||
2 files changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/extension/ChangeLog b/extension/ChangeLog
|
||||
index 40ed6dd0..52a4c6ab 100644
|
||||
--- a/extension/ChangeLog
|
||||
+++ b/extension/ChangeLog
|
||||
@@ -1,3 +1,9 @@
|
||||
+2026-04-15 Arnold D. Robbins <arnold@skeeve.com>
|
||||
+
|
||||
+ * readdir.c (ftype): Use snprintf() to check for buffer
|
||||
+ overflow in the file name before calling stat(). Thanks to
|
||||
+ Marcin Wyczechowski <mwyczechowski@afine.com> for the report.
|
||||
+
|
||||
2023-11-02 Arnold D. Robbins <arnold@skeeve.com>
|
||||
|
||||
* 5.3.0: Release tar ball made.
|
||||
diff --git a/extension/readdir.c b/extension/readdir.c
|
||||
index 788e1d1e..b525fe21 100644
|
||||
--- a/extension/readdir.c
|
||||
+++ b/extension/readdir.c
|
||||
@@ -117,8 +117,12 @@ ftype(struct dirent *entry, const char *dirname)
|
||||
#endif
|
||||
char fname[PATH_MAX];
|
||||
struct stat sbuf;
|
||||
+ int count;
|
||||
+
|
||||
+ count = snprintf(fname, sizeof(fname), "%s/%s", dirname, entry->d_name);
|
||||
+ if (count > sizeof(fname))
|
||||
+ return "u"; // buffer overflow. skip stat() call.
|
||||
|
||||
- sprintf(fname, "%s/%s", dirname, entry->d_name);
|
||||
if (stat(fname, &sbuf) == 0) {
|
||||
if (S_ISBLK(sbuf.st_mode))
|
||||
return "b";
|
||||
--
|
||||
2.44.4
|
||||
|
||||
44
meta/recipes-extended/gawk/gawk/CVE-2026-40553_p2.patch
Normal file
44
meta/recipes-extended/gawk/gawk/CVE-2026-40553_p2.patch
Normal file
@@ -0,0 +1,44 @@
|
||||
From 8b08dcf6c784e7a98d08e9e63a8fda15040eee30 Mon Sep 17 00:00:00 2001
|
||||
From: "Arnold D. Robbins" <arnold@skeeve.com>
|
||||
Date: Fri, 17 Apr 2026 11:48:19 +0300
|
||||
Subject: [PATCH] Small fix in extension/readdir.c.
|
||||
|
||||
CVE: CVE-2026-40553
|
||||
Upstream-Status: Backport [https://cgit.git.savannah.gnu.org/cgit/gawk.git/commit/?id=bfa2e4b890a44100a99d26b54af385479528b12e]
|
||||
|
||||
(cherry picked from commit bfa2e4b890a44100a99d26b54af385479528b12e)
|
||||
Signed-off-by: Darsh Kelaiya <dkelaiya@cisco.com>
|
||||
---
|
||||
extension/ChangeLog | 5 +++++
|
||||
extension/readdir.c | 2 +-
|
||||
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/extension/ChangeLog b/extension/ChangeLog
|
||||
index 52a4c6ab..c8839357 100644
|
||||
--- a/extension/ChangeLog
|
||||
+++ b/extension/ChangeLog
|
||||
@@ -1,3 +1,8 @@
|
||||
+2026-04-15 Arnold D. Robbins <arnold@skeeve.com>
|
||||
+
|
||||
+ * readdir.c (ftype): Use >= in check of snprintf() return
|
||||
+ value. Thanks to Andrew Schorr <aschorr@telemetry-investments.com>.
|
||||
+
|
||||
2026-04-15 Arnold D. Robbins <arnold@skeeve.com>
|
||||
|
||||
* readdir.c (ftype): Use snprintf() to check for buffer
|
||||
diff --git a/extension/readdir.c b/extension/readdir.c
|
||||
index b525fe21..6f9b6811 100644
|
||||
--- a/extension/readdir.c
|
||||
+++ b/extension/readdir.c
|
||||
@@ -120,7 +120,7 @@ ftype(struct dirent *entry, const char *dirname)
|
||||
int count;
|
||||
|
||||
count = snprintf(fname, sizeof(fname), "%s/%s", dirname, entry->d_name);
|
||||
- if (count > sizeof(fname))
|
||||
+ if (count >= sizeof(fname))
|
||||
return "u"; // buffer overflow. skip stat() call.
|
||||
|
||||
if (stat(fname, &sbuf) == 0) {
|
||||
--
|
||||
2.44.4
|
||||
|
||||
@@ -25,6 +25,8 @@ SRC_URI = "${GNU_MIRROR}/gawk/gawk-${PV}.tar.gz \
|
||||
file://CVE-2026-40467.patch \
|
||||
file://CVE-2026-40468.patch \
|
||||
file://CVE-2026-40469.patch \
|
||||
file://CVE-2026-40553_p1.patch \
|
||||
file://CVE-2026-40553_p2.patch \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "378f8864ec21cfceaa048f7e1869ac9b4597b449087caf1eb55e440d30273336"
|
||||
|
||||
Reference in New Issue
Block a user