From 2d45d074e0843f51e831b9f0a9eae58874914fcb Mon Sep 17 00:00:00 2001 From: xujing Date: Tue, 12 Apr 2022 11:09:21 +0800 Subject: [PATCH] check whether command_prev is null before assigning value (cherry picked from commit 772acaddacf0045c6a0459244e5c8f9572591a45) --- ...mmand_prev-is-null-before-assigning-.patch | 35 +++++++++++++++++++ systemd.spec | 6 +++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 0026-check-whether-command_prev-is-null-before-assigning-.patch diff --git a/0026-check-whether-command_prev-is-null-before-assigning-.patch b/0026-check-whether-command_prev-is-null-before-assigning-.patch new file mode 100644 index 0000000..bdca1fe --- /dev/null +++ b/0026-check-whether-command_prev-is-null-before-assigning-.patch @@ -0,0 +1,35 @@ +From 5fe226b4378a2466d906ae45b8544f1003e9885a Mon Sep 17 00:00:00 2001 +From: yefei25 +Date: Wed, 8 Apr 2020 23:10:58 -0400 +Subject: [PATCH 1/2] check whether command_prev is null before assigning value + +--- + src/core/service.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/core/service.c b/src/core/service.c +index 9a26271f72..3c255b3bcc 100644 +--- a/src/core/service.c ++++ b/src/core/service.c +@@ -2569,12 +2569,16 @@ static unsigned service_exec_command_index(Unit *u, ServiceExecCommand id, ExecC + assert(s); + assert(id >= 0); + assert(id < _SERVICE_EXEC_COMMAND_MAX); +- ++ if (!current) ++ return 0; + first = s->exec_command[id]; + + /* Figure out where we are in the list by walking back to the beginning */ +- for (c = current; c != first; c = c->command_prev) ++ for (c = current; c != first; c = c->command_prev) { + idx++; ++ if (!c->command_prev) ++ return idx; ++ } + + return idx; + } +-- +2.19.1 + diff --git a/systemd.spec b/systemd.spec index 0211f30..c149012 100644 --- a/systemd.spec +++ b/systemd.spec @@ -20,7 +20,7 @@ Name: systemd Url: https://www.freedesktop.org/wiki/Software/systemd Version: 249 -Release: 22 +Release: 23 License: MIT and LGPLv2+ and GPLv2+ Summary: System and Service Manager @@ -71,6 +71,7 @@ Patch0022: 0022-systemd-core-fix-problem-of-dbus-service-can-not-be-started Patch0023: 0023-delay-to-restart-when-a-service-can-not-be-auto-restarted.patch Patch0024: 0024-disable-initialize_clock.patch Patch0025: 0025-systemd-solve-that-rsyslog-reads-journal-s-object-of.patch +Patch0026: 0026-check-whether-command_prev-is-null-before-assigning-.patch #backport Patch6000: backport-core-fix-free-undefined-pointer-when-strdup-failed-i.patch @@ -1502,6 +1503,9 @@ fi %{_libdir}/security/pam_systemd.so %changelog +* Tue Apr 12 2022 xujing - 249-23 +- check whether command_prev is null before assigning value + * Mon Apr 11 2022 xujing - 249-22 - solve that rsyslog reads journal's object of size 0