core: limit the number of units that can be requested over ListUnitsByNames

This commit is contained in:
Frantisek Sumsal
2026-04-29 12:58:58 +02:00
parent 0d71d58da0
commit 51a88ac723
+4
View File
@@ -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;