30 lines
1.1 KiB
Diff
30 lines
1.1 KiB
Diff
From f7a9f500ea223e8cee700d0acdc3a298fb3e0a58 Mon Sep 17 00:00:00 2001
|
|
From: Mike Yuan <me@yhndnzj.com>
|
|
Date: Thu, 26 Feb 2026 11:06:34 +0100
|
|
Subject: [PATCH] core: validate input cgroup path more prudently
|
|
|
|
(cherry picked from commit efa6ba2ab625aaa160ac435a09e6482fc63bdbe8)
|
|
|
|
Resolves: RHEL-155393
|
|
---
|
|
src/core/dbus-manager.c | 6 ++++++
|
|
1 file changed, 6 insertions(+)
|
|
|
|
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
|
|
index 3f62b30745..16c9680d80 100644
|
|
--- a/src/core/dbus-manager.c
|
|
+++ b/src/core/dbus-manager.c
|
|
@@ -666,6 +666,12 @@ static int method_get_unit_by_control_group(sd_bus_message *message, void *userd
|
|
if (r < 0)
|
|
return r;
|
|
|
|
+ if (!path_is_absolute(cgroup))
|
|
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Control group path is not absolute: %s", cgroup);
|
|
+
|
|
+ if (!path_is_normalized(cgroup))
|
|
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Control group path is not normalized: %s", cgroup);
|
|
+
|
|
u = manager_get_unit_by_cgroup(m, cgroup);
|
|
if (!u)
|
|
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT,
|