Skip to content

Commit 1d22f70

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

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
@@ -623,6 +623,12 @@ static int method_get_unit_by_control_group(sd_bus_message *message, void *userd
623623
if (r < 0)
624624
return r;
625625

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

0 commit comments

Comments
 (0)