Rich.
-- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903
Index: qemud/remote.c
===================================================================
RCS file: /data/cvs/libvirt/qemud/remote.c,v
retrieving revision 1.2
diff -u -p -r1.2 remote.c
--- qemud/remote.c 22 Jun 2007 13:16:10 -0000 1.2
+++ qemud/remote.c 22 Jun 2007 15:22:00 -0000
@@ -956,14 +956,14 @@ remoteDispatchDomainGetVcpus (struct qem
return -2;
}
- if (args->maplen > REMOTE_CPUMAPS_MAX) {
- remoteDispatchError (client, req, "maplen > REMOTE_CPUMAPS_MAX");
+ if (args->maxinfo * args->maplen > REMOTE_CPUMAPS_MAX) {
+ remoteDispatchError (client, req, "maxinfo * maplen > REMOTE_CPUMAPS_MAX");
return -2;
}
/* Allocate buffers to take the results. */
info = calloc (args->maxinfo, sizeof (virVcpuInfo));
- cpumaps = calloc (args->maplen, sizeof (unsigned char));
+ cpumaps = calloc (args->maxinfo * args->maplen, sizeof (unsigned char));
info_len = virDomainGetVcpus (dom,
info, args->maxinfo,
@@ -985,7 +985,7 @@ remoteDispatchDomainGetVcpus (struct qem
* assumption that unsigned char and char are the same size.
* Note that remoteDispatchClientRequest will free.
*/
- ret->cpumaps.cpumaps_len = args->maplen;
+ ret->cpumaps.cpumaps_len = args->maxinfo * args->maplen;
ret->cpumaps.cpumaps_val = (char *) cpumaps;
return 0;
Index: src/remote_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/remote_internal.c,v
retrieving revision 1.4
diff -u -p -r1.4 remote_internal.c
--- src/remote_internal.c 22 Jun 2007 13:16:10 -0000 1.4
+++ src/remote_internal.c 22 Jun 2007 15:22:02 -0000
@@ -1472,7 +1472,7 @@ remoteDomainGetVcpus (virDomainPtr domai
error (domain->conn, VIR_ERR_RPC, "maxinfo > REMOTE_VCPUINFO_MAX");
return -1;
}
- if (maplen > REMOTE_CPUMAPS_MAX) {
+ if (maxinfo * maplen > REMOTE_CPUMAPS_MAX) {
error (domain->conn, VIR_ERR_RPC, "maplen > REMOTE_CPUMAPS_MAX");
return -1;
}
@@ -1492,12 +1492,15 @@ remoteDomainGetVcpus (virDomainPtr domai
xdr_free ((xdrproc_t) xdr_remote_domain_get_vcpus_ret, (char *) &ret);
return -1;
}
- if (ret.cpumaps.cpumaps_len > maplen) {
- error (domain->conn, VIR_ERR_RPC, "ret.cpumaps.cpumaps_len > maplen");
+ if (ret.cpumaps.cpumaps_len > maxinfo * maplen) {
+ error (domain->conn, VIR_ERR_RPC, "ret.cpumaps.cpumaps_len > maxinfo * maplen");
xdr_free ((xdrproc_t) xdr_remote_domain_get_vcpus_ret, (char *) &ret);
return -1;
}
+ memset (info, 0, sizeof (virVcpuInfo) * maxinfo);
+ memset (cpumaps, 0, maxinfo * maplen);
+
for (i = 0; i < ret.info.info_len; ++i) {
info[i].number = ret.info.info_val[i].number;
info[i].state = ret.info.info_val[i].state;
smime.p7s
Description: S/MIME Cryptographic Signature
-- Libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
