From: Frantisek Sumsal Date: Wed, 29 Apr 2026 10:02:32 +0000 (+0200) Subject: core: limit the number of units that can be requested over ListUnitsByNames X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=51a88ac72330f20a030b8938b6bfce2b2215d8a0;p=thirdparty%2Fsystemd.git core: limit the number of units that can be requested over ListUnitsByNames --- 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;