summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
authorRanjitsinh Rathod <ranjitsinh.rathod@kpit.com>2022-11-14 20:20:23 +0530
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-12-07 15:06:36 +0000
commit4341dc995398c36f9ea48446e415a094dfd0a8bd (patch)
treee5996e42c690f07b0052111a561cf33e978c0af6 /meta/recipes-core
parent4978b9a24fef2047f2f86ecdd7e6deb14d34a1c0 (diff)
downloadpoky-4341dc995398c36f9ea48446e415a094dfd0a8bd.tar.gz
systemd: Fix CVE-2022-3821 issue
An off-by-one Error issue was discovered in Systemd in format_timespan() function of time-util.c. An attacker could supply specific values for time and accuracy that leads to buffer overrun in format_timespan(), leading to a Denial of Service. Add a patch to solve above CVE issue Link: https://github.com/systemd/systemd/commit/9102c625a673a3246d7e73d8737f3494446bad4e (From OE-Core rev: e2db40ca49b8ed217f14c7f861087837e8b3f389) Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com> Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/systemd/systemd/CVE-2022-3821.patch47
-rw-r--r--meta/recipes-core/systemd/systemd_244.5.bb1
2 files changed, 48 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/CVE-2022-3821.patch b/meta/recipes-core/systemd/systemd/CVE-2022-3821.patch
new file mode 100644
index 0000000000..f9c6704cfc
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/CVE-2022-3821.patch
@@ -0,0 +1,47 @@
1From 9102c625a673a3246d7e73d8737f3494446bad4e Mon Sep 17 00:00:00 2001
2From: Yu Watanabe <watanabe.yu+github@gmail.com>
3Date: Thu, 7 Jul 2022 18:27:02 +0900
4Subject: [PATCH] time-util: fix buffer-over-run
5
6Fixes #23928.
7
8CVE: CVE-2022-3821
9Upstream-Status: Backport [https://github.com/systemd/systemd/commit/9102c625a673a3246d7e73d8737f3494446bad4e.patch]
10Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
11Comment: Both the hunks refreshed to backport
12
13---
14 src/basic/time-util.c | 2 +-
15 src/test/test-time-util.c | 5 +++++
16 2 files changed, 6 insertions(+), 1 deletion(-)
17
18diff --git a/src/basic/time-util.c b/src/basic/time-util.c
19index abbc4ad5cd70..26d59de12348 100644
20--- a/src/basic/time-util.c
21+++ b/src/basic/time-util.c
22@@ -514,7 +514,7 @@ char *format_timespan(char *buf, size_t
23 t = b;
24 }
25
26- n = MIN((size_t) k, l);
27+ n = MIN((size_t) k, l-1);
28
29 l -= n;
30 p += n;
31diff --git a/src/test/test-time-util.c b/src/test/test-time-util.c
32index e8e4e2a67bb1..58c5fa9be40c 100644
33--- a/src/test/test-time-util.c
34+++ b/src/test/test-time-util.c
35@@ -501,6 +501,12 @@ int main(int argc, char *argv[]) {
36 test_format_timespan(1);
37 test_format_timespan(USEC_PER_MSEC);
38 test_format_timespan(USEC_PER_SEC);
39+
40+ /* See issue #23928. */
41+ _cleanup_free_ char *buf;
42+ assert_se(buf = new(char, 5));
43+ assert_se(buf == format_timespan(buf, 5, 100005, 1000));
44+
45 test_timezone_is_valid();
46 test_get_timezones();
47 test_usec_add();
diff --git a/meta/recipes-core/systemd/systemd_244.5.bb b/meta/recipes-core/systemd/systemd_244.5.bb
index f3e5395465..77ef2bc42f 100644
--- a/meta/recipes-core/systemd/systemd_244.5.bb
+++ b/meta/recipes-core/systemd/systemd_244.5.bb
@@ -33,6 +33,7 @@ SRC_URI += "file://touchscreen.rules \
33 file://CVE-2021-3997-1.patch \ 33 file://CVE-2021-3997-1.patch \
34 file://CVE-2021-3997-2.patch \ 34 file://CVE-2021-3997-2.patch \
35 file://CVE-2021-3997-3.patch \ 35 file://CVE-2021-3997-3.patch \
36 file://CVE-2022-3821.patch \
36 " 37 "
37 38
38# patches needed by musl 39# patches needed by musl