Add bounds checking on virConnectListAllNWFilters RPC call

The return values for the virConnectListAllNWFilters 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:
Daniel P. Berrange
2013-08-19 14:47:22 +01:00
parent 1dcff6a7ea
commit 12034511a1
3 changed files with 18 additions and 4 deletions

View File

@@ -4374,6 +4374,13 @@ remoteDispatchConnectListAllNWFilters(virNetServerPtr server ATTRIBUTE_UNUSED,
args->flags)) < 0)
goto cleanup;
if (nfilters > REMOTE_NWFILTER_LIST_MAX) {
virReportError(VIR_ERR_RPC,
_("Too many network filters '%d' for limit '%d'"),
nfilters, REMOTE_NWFILTER_LIST_MAX);
goto cleanup;
}
if (filters && nfilters) {
if (VIR_ALLOC_N(ret->filters.filters_val, nfilters) < 0)
goto cleanup;