diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-05-20 14:53:22 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-05-20 14:59:50 +0200 |
commit | 4313e2b69fe1bcddd7b551e171f1fa3554155968 (patch) | |
tree | adc527cc6a7a3df1fbe6b95c9c176a5b3770444c /src/portable | |
parent | d316426eeef830e44a05248595eba8cdc7085d3b (diff) | |
download | systemd-4313e2b69fe1bcddd7b551e171f1fa3554155968.tar.gz |
portabled: refuse queries for empty image name
I took inspiration from pid1:
bus_unit_find()
→ find_unit()
→ manager_load_unit_from_dbus_path()
→ unit_name_from_dbus_path()
→ !startswith(path, "/org/freedesktop/systemd1/unit/")
→ return -EINVAL
←
←
←
← if (r < 0) return 0
← 0
←
i.e. we return 0 when queried for "/org/freedesktop/systemd1/unit".
Fixes #23445.
Diffstat (limited to 'src/portable')
-rw-r--r-- | src/portable/portabled-image-bus.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/portable/portabled-image-bus.c b/src/portable/portabled-image-bus.c index 3fe0eca4c5..7d69d776eb 100644 --- a/src/portable/portabled-image-bus.c +++ b/src/portable/portabled-image-bus.c @@ -1120,6 +1120,9 @@ int bus_image_object_find( return 0; if (r == 0) goto not_found; + if (isempty(e)) + /* The path is "/org/freedesktop/portable1/image" itself */ + goto not_found; r = bus_image_acquire(m, sd_bus_get_current_message(bus), e, NULL, BUS_IMAGE_REFUSE_BY_PATH, NULL, &image, error); if (r == -ENOENT) |