summaryrefslogtreecommitdiffstats
path: root/meta-initramfs
diff options
context:
space:
mode:
authorGyorgy Sarvari <skandigraun@gmail.com>2025-10-27 15:15:49 +0100
committerGyorgy Sarvari <skandigraun@gmail.com>2025-10-27 18:06:49 +0100
commitaec3f2b6127a3bb5a9241eb30a89c599d4e460de (patch)
treebedb0c0734848f19fadde7f8040e2d8704621084 /meta-initramfs
parentdab398c7e0645dccf6c66f26e2d0ddc22395e695 (diff)
downloadmeta-openembedded-aec3f2b6127a3bb5a9241eb30a89c599d4e460de.tar.gz
klibc: patch CVE-2021-31871
Details: https://nvd.nist.gov/vuln/detail/CVE-2021-31871 Pick the patch mentioned in the nvd report. Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Diffstat (limited to 'meta-initramfs')
-rw-r--r--meta-initramfs/recipes-devtools/klibc/files/CVE-2021-31871.patch34
-rw-r--r--meta-initramfs/recipes-devtools/klibc/klibc.inc1
2 files changed, 35 insertions, 0 deletions
diff --git a/meta-initramfs/recipes-devtools/klibc/files/CVE-2021-31871.patch b/meta-initramfs/recipes-devtools/klibc/files/CVE-2021-31871.patch
new file mode 100644
index 0000000000..c8c40ec931
--- /dev/null
+++ b/meta-initramfs/recipes-devtools/klibc/files/CVE-2021-31871.patch
@@ -0,0 +1,34 @@
1From db29a01c413fcaaa1095284dfe31582e97d35679 Mon Sep 17 00:00:00 2001
2From: Ben Hutchings <ben@decadent.org.uk>
3Date: Wed, 28 Apr 2021 19:46:47 +0200
4Subject: [PATCH] cpio: Fix possible crash on 64-bit systems
5
6copyin_link() tries to allocate (unsigned int)c_filesize + 1 bytes.
7If c_filesize == UINT_MAX, this works out as 0 bytes, resulting in a
8null pointer and a subsequent SIGSEGV.
9
10The previous commit made this impossible on 32-bit systems.
11
12CVE-2021-31871
13
14CVE: CVE-2021-31871
15Upstream-Status: Backport [https://git.kernel.org/pub/scm/libs/klibc/klibc.git/commit/?id=2e48a12ab1e30d43498c2d53e878a11a1b5102d5]
16
17Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
18---
19 usr/utils/cpio.c | 2 +-
20 1 file changed, 1 insertion(+), 1 deletion(-)
21
22diff --git a/usr/utils/cpio.c b/usr/utils/cpio.c
23index cb61679..a13c876 100644
24--- a/usr/utils/cpio.c
25+++ b/usr/utils/cpio.c
26@@ -831,7 +831,7 @@ static void copyin_link(struct new_cpio_header *file_hdr, int in_file_des)
27 char *link_name = NULL; /* Name of hard and symbolic links. */
28 int res; /* Result of various function calls. */
29
30- link_name = (char *)xmalloc((unsigned int)file_hdr->c_filesize + 1);
31+ link_name = (char *)xmalloc(file_hdr->c_filesize + 1);
32 link_name[file_hdr->c_filesize] = '\0';
33 tape_buffered_read(link_name, in_file_des, file_hdr->c_filesize);
34 tape_skip_padding(in_file_des, file_hdr->c_filesize);
diff --git a/meta-initramfs/recipes-devtools/klibc/klibc.inc b/meta-initramfs/recipes-devtools/klibc/klibc.inc
index dd22282b40..ccf4a56953 100644
--- a/meta-initramfs/recipes-devtools/klibc/klibc.inc
+++ b/meta-initramfs/recipes-devtools/klibc/klibc.inc
@@ -22,6 +22,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/libs/klibc/2.0/klibc-${PV}.tar.xz \
22 file://cross-clang.patch \ 22 file://cross-clang.patch \
23 file://0001-workaround-for-overlapping-sections-in-binary.patch \ 23 file://0001-workaround-for-overlapping-sections-in-binary.patch \
24 file://CVE-2021-31870.patch \ 24 file://CVE-2021-31870.patch \
25 file://CVE-2021-31871.patch \
25 " 26 "
26 27
27ARMPATCHES ?= "" 28ARMPATCHES ?= ""