Skip to content

Commit 54588d2

Browse files
YHNdnzjbluca
authored andcommitted
core: validate input cgroup path more prudently
(cherry picked from commit efa6ba2) (cherry picked from commit 3cee294) (cherry picked from commit 1d22f70)
1 parent 2116700 commit 54588d2

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/core/dbus-manager.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,12 @@ static int method_get_unit_by_control_group(sd_bus_message *message, void *userd
621621
if (r < 0)
622622
return r;
623623

624+
if (!path_is_absolute(cgroup))
625+
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Control group path is not absolute: %s", cgroup);
626+
627+
if (!path_is_normalized(cgroup))
628+
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Control group path is not normalized: %s", cgroup);
629+
624630
u = manager_get_unit_by_cgroup(m, cgroup);
625631
if (!u)
626632
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT,

0 commit comments

Comments
 (0)