diff --git a/daemon/remote.c b/daemon/remote.c index 8289cb5d5cc5f1d5d388767edd3bbdc2bc87b4cc..42c1c47fd4a3f31714b3e37113187c2464cde925 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -4073,6 +4073,13 @@ remoteDispatchConnectListAllStoragePools(virNetServerPtr server ATTRIBUTE_UNUSED args->flags)) < 0) goto cleanup; + if (npools > REMOTE_STORAGE_POOL_LIST_MAX) { + virReportError(VIR_ERR_RPC, + _("Too many storage pools '%d' for limit '%d'"), + npools, REMOTE_STORAGE_POOL_LIST_MAX); + goto cleanup; + } + if (pools && npools) { if (VIR_ALLOC_N(ret->pools.pools_val, npools) < 0) goto cleanup; diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index cd2b9a98c3991a34627e18703547ca7f29b8ba73..622647bcc212f25b70ba22b844e5c41e538527a4 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -3276,6 +3276,13 @@ remoteConnectListAllStoragePools(virConnectPtr conn, (char *) &ret) == -1) goto done; + if (ret.pools.pools_len > REMOTE_STORAGE_POOL_LIST_MAX) { + virReportError(VIR_ERR_RPC, + _("Too many storage pools '%d' for limit '%d'"), + ret.pools.pools_len, REMOTE_STORAGE_POOL_LIST_MAX); + goto cleanup; + } + if (pools) { if (VIR_ALLOC_N(tmp_pools, ret.pools.pools_len + 1) < 0) goto cleanup; diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 718e39830572e0b8b1807bb18740c04cd9648f3b..6e996b4eff5e48095659097f27f22a022d8d6195 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -97,8 +97,8 @@ const REMOTE_INTERFACE_NAME_LIST_MAX = 16384; /* Upper limit on lists of defined interface names. */ const REMOTE_DEFINED_INTERFACE_NAME_LIST_MAX = 16384; -/* Upper limit on lists of storage pool names. */ -const REMOTE_STORAGE_POOL_NAME_LIST_MAX = 4096; +/* Upper limit on lists of storage pools. */ +const REMOTE_STORAGE_POOL_LIST_MAX = 4096; /* Upper limit on lists of storage vol names. */ const REMOTE_STORAGE_VOL_NAME_LIST_MAX = 16384; @@ -1604,7 +1604,7 @@ struct remote_connect_list_storage_pools_args { }; struct remote_connect_list_storage_pools_ret { - remote_nonnull_string names; /* insert@1 */ + remote_nonnull_string names; /* insert@1 */ }; struct remote_connect_num_of_defined_storage_pools_ret { @@ -1616,7 +1616,7 @@ struct remote_connect_list_defined_storage_pools_args { }; struct remote_connect_list_defined_storage_pools_ret { - remote_nonnull_string names; /* insert@1 */ + remote_nonnull_string names; /* insert@1 */ }; struct remote_connect_find_storage_pool_sources_args { @@ -2670,7 +2670,7 @@ struct remote_connect_list_all_storage_pools_args { }; struct remote_connect_list_all_storage_pools_ret { - remote_nonnull_storage_pool pools<>; + remote_nonnull_storage_pool pools; unsigned int ret; };