mirror of
https://git.yoctoproject.org/poky
synced 2026-06-03 01:40:07 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
4978b9a24f
commit
4341dc9953
@@ -0,0 +1,47 @@
|
|||||||
|
From 9102c625a673a3246d7e73d8737f3494446bad4e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||||
|
Date: Thu, 7 Jul 2022 18:27:02 +0900
|
||||||
|
Subject: [PATCH] time-util: fix buffer-over-run
|
||||||
|
|
||||||
|
Fixes #23928.
|
||||||
|
|
||||||
|
CVE: CVE-2022-3821
|
||||||
|
Upstream-Status: Backport [https://github.com/systemd/systemd/commit/9102c625a673a3246d7e73d8737f3494446bad4e.patch]
|
||||||
|
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
|
||||||
|
Comment: Both the hunks refreshed to backport
|
||||||
|
|
||||||
|
---
|
||||||
|
src/basic/time-util.c | 2 +-
|
||||||
|
src/test/test-time-util.c | 5 +++++
|
||||||
|
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/basic/time-util.c b/src/basic/time-util.c
|
||||||
|
index abbc4ad5cd70..26d59de12348 100644
|
||||||
|
--- a/src/basic/time-util.c
|
||||||
|
+++ b/src/basic/time-util.c
|
||||||
|
@@ -514,7 +514,7 @@ char *format_timespan(char *buf, size_t
|
||||||
|
t = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
- n = MIN((size_t) k, l);
|
||||||
|
+ n = MIN((size_t) k, l-1);
|
||||||
|
|
||||||
|
l -= n;
|
||||||
|
p += n;
|
||||||
|
diff --git a/src/test/test-time-util.c b/src/test/test-time-util.c
|
||||||
|
index e8e4e2a67bb1..58c5fa9be40c 100644
|
||||||
|
--- a/src/test/test-time-util.c
|
||||||
|
+++ b/src/test/test-time-util.c
|
||||||
|
@@ -501,6 +501,12 @@ int main(int argc, char *argv[]) {
|
||||||
|
test_format_timespan(1);
|
||||||
|
test_format_timespan(USEC_PER_MSEC);
|
||||||
|
test_format_timespan(USEC_PER_SEC);
|
||||||
|
+
|
||||||
|
+ /* See issue #23928. */
|
||||||
|
+ _cleanup_free_ char *buf;
|
||||||
|
+ assert_se(buf = new(char, 5));
|
||||||
|
+ assert_se(buf == format_timespan(buf, 5, 100005, 1000));
|
||||||
|
+
|
||||||
|
test_timezone_is_valid();
|
||||||
|
test_get_timezones();
|
||||||
|
test_usec_add();
|
||||||
@@ -33,6 +33,7 @@ SRC_URI += "file://touchscreen.rules \
|
|||||||
file://CVE-2021-3997-1.patch \
|
file://CVE-2021-3997-1.patch \
|
||||||
file://CVE-2021-3997-2.patch \
|
file://CVE-2021-3997-2.patch \
|
||||||
file://CVE-2021-3997-3.patch \
|
file://CVE-2021-3997-3.patch \
|
||||||
|
file://CVE-2022-3821.patch \
|
||||||
"
|
"
|
||||||
|
|
||||||
# patches needed by musl
|
# patches needed by musl
|
||||||
|
|||||||
Reference in New Issue
Block a user