From 51a88ac72330f20a030b8938b6bfce2b2215d8a0 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Wed, 29 Apr 2026 12:02:32 +0200 Subject: [PATCH] core: limit the number of units that can be requested over ListUnitsByNames --- src/core/dbus-manager.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 1bc73e7b434..6579708df01 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -971,6 +971,10 @@ static int method_list_units_by_names(sd_bus_message *message, void *userdata, s if (r < 0) return r; + if (strv_length(units) > MAX(hashmap_size(m->units), (unsigned) MANAGER_MAX_NAMES / 2)) + return sd_bus_error_set(reterr_error, SD_BUS_ERROR_LIMITS_EXCEEDED, + "Too many unit names requested."); + r = sd_bus_message_new_method_return(message, &reply); if (r < 0) return r; -- 2.47.3