From 335ec7116992573d041ae860bfd92a4d14dcb24f Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Wed, 5 Apr 2023 17:55:15 +0300 Subject: [PATCH] import systemd-250-12.el9_1.1 --- .../0352-time-util-fix-buffer-over-run.patch | 44 +++++++++++++++++++ SPECS/systemd.spec | 6 ++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 SOURCES/0352-time-util-fix-buffer-over-run.patch diff --git a/SOURCES/0352-time-util-fix-buffer-over-run.patch b/SOURCES/0352-time-util-fix-buffer-over-run.patch new file mode 100644 index 0000000..08c53f4 --- /dev/null +++ b/SOURCES/0352-time-util-fix-buffer-over-run.patch @@ -0,0 +1,44 @@ +From 694ffe6e760878bf4983fc63f5c9fe109e19b80e Mon Sep 17 00:00:00 2001 +From: Yu Watanabe +Date: Thu, 7 Jul 2022 18:27:02 +0900 +Subject: [PATCH] time-util: fix buffer-over-run + +Fixes #23928. + +(cherry picked from commit 9102c625a673a3246d7e73d8737f3494446bad4e) + +Resolves: #2139388 +--- + 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 c0841af8f3..4610c37273 100644 +--- a/src/basic/time-util.c ++++ b/src/basic/time-util.c +@@ -598,7 +598,7 @@ char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy) { + 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 15f4a0c169..20ad521db7 100644 +--- a/src/test/test-time-util.c ++++ b/src/test/test-time-util.c +@@ -238,6 +238,11 @@ TEST(format_timespan) { + test_format_timespan_accuracy(1); + test_format_timespan_accuracy(USEC_PER_MSEC); + test_format_timespan_accuracy(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(verify_timezone) { diff --git a/SPECS/systemd.spec b/SPECS/systemd.spec index b6b9e45..26ef1c6 100644 --- a/SPECS/systemd.spec +++ b/SPECS/systemd.spec @@ -21,7 +21,7 @@ Name: systemd Url: https://www.freedesktop.org/wiki/Software/systemd Version: 250 -Release: 12%{?dist} +Release: 12%{?dist}.1 # For a breakdown of the licensing, see README License: LGPLv2+ and MIT and GPLv2+ Summary: System and Service Manager @@ -429,6 +429,7 @@ Patch0348: 0348-test-terminate-session-and-user-on-cleanup.patch Patch0349: 0349-test-do-not-restart-getty-tty2-automatically.patch Patch0350: 0350-tests-add-test-for-StopIdleSessionSec-option.patch Patch0351: 0351-logind-schedule-idle-check-full-interval-from-now-if.patch +Patch0352: 0352-time-util-fix-buffer-over-run.patch # Downstream-only patches (9000–9999) @@ -1213,6 +1214,9 @@ getent passwd systemd-oom &>/dev/null || useradd -r -l -g systemd-oom -d / -s /s * Wed Mar 15 2023 MSVSphere Packaging Team - 250-12 - Rebuilt for MSVSphere 9.1. +* Mon Nov 07 2022 systemd maintenance team - 250-12.1 +- time-util: fix buffer-over-run (#2139388) + * Fri Sep 23 2022 systemd maintenance team - 250-12 - core/load-fragment: move config_parse_sec_fix_0 to src/shared (#2100464) - logind: add option to stop idle sessions after specified timeout (#2100464)