new file mode 100644
@@ -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
+
new file mode 100644
@@ -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"