summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-core/coreutils/coreutils/0001-split-do-not-shrink-hold-buffer.patch42
-rw-r--r--meta/recipes-core/coreutils/coreutils_9.0.bb1
2 files changed, 43 insertions, 0 deletions
diff --git a/meta/recipes-core/coreutils/coreutils/0001-split-do-not-shrink-hold-buffer.patch b/meta/recipes-core/coreutils/coreutils/0001-split-do-not-shrink-hold-buffer.patch
new file mode 100644
index 0000000000..3eab65dcf1
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils/0001-split-do-not-shrink-hold-buffer.patch
@@ -0,0 +1,42 @@
1From 80dca40bbb36b7b1630bb5a43d62b3ff21b4e064 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Nov 2024 23:43:49 -0800
4Subject: [PATCH] split: do not shrink hold buffer
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9* src/split.c (line_bytes_split): Do not shrink hold buffer.
10If it’s large for this batch it’s likely to be large for the next
11batch, and for ‘split’ it’s not worth the complexity/CPU hassle to
12shrink it. Do not assume hold_size can be bufsize.
13
14CVE: CVE-2024-0684
15
16Upstream-Status: Backport [c4c5ed8f4e9cd55a12966d4f520e3a13101637d9]
17
18The original patch is tweaked to fit the current version.
19
20Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
21---
22 src/split.c | 3 ---
23 1 file changed, 3 deletions(-)
24
25diff --git a/src/split.c b/src/split.c
26index 4b1b144..e44e867 100644
27--- a/src/split.c
28+++ b/src/split.c
29@@ -785,10 +785,7 @@ line_bytes_split (uintmax_t n_bytes, char *buf, size_t bufsize)
30 {
31 cwrite (n_out == 0, hold, n_hold);
32 n_out += n_hold;
33- if (n_hold > bufsize)
34- hold = xrealloc (hold, bufsize);
35 n_hold = 0;
36- hold_size = bufsize;
37 }
38
39 /* Output to eol if present. */
40--
412.25.1
42
diff --git a/meta/recipes-core/coreutils/coreutils_9.0.bb b/meta/recipes-core/coreutils/coreutils_9.0.bb
index 8a2fbeca32..1cce9192ec 100644
--- a/meta/recipes-core/coreutils/coreutils_9.0.bb
+++ b/meta/recipes-core/coreutils/coreutils_9.0.bb
@@ -20,6 +20,7 @@ SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz \
20 file://0001-local.mk-fix-cross-compiling-problem.patch \ 20 file://0001-local.mk-fix-cross-compiling-problem.patch \
21 file://e8b56ebd536e82b15542a00c888109471936bfda.patch \ 21 file://e8b56ebd536e82b15542a00c888109471936bfda.patch \
22 file://run-ptest \ 22 file://run-ptest \
23 file://0001-split-do-not-shrink-hold-buffer.patch \
23 " 24 "
24 25
25SRC_URI[sha256sum] = "ce30acdf4a41bc5bb30dd955e9eaa75fa216b4e3deb08889ed32433c7b3b97ce" 26SRC_URI[sha256sum] = "ce30acdf4a41bc5bb30dd955e9eaa75fa216b4e3deb08889ed32433c7b3b97ce"