core: limit the number of units that can be requested over ListUnitsByNames
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user