mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Add bounds checking on virConnectListAllStoragePools RPC call
The return values for the virConnectListAllStoragePools call were not bounds checked. This is a robustness issue for clients if something where to cause corruption of the RPC stream data. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user