]> xenbits.xensource.com Git - libvirt.git/commitdiff
vz: Fix invalid iteration of def->cputune.vcpupin
authorPeter Krempa <pkrempa@redhat.com>
Fri, 18 Dec 2015 15:55:01 +0000 (16:55 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 25 Jan 2016 16:45:09 +0000 (17:45 +0100)
The array doesn't necessarily have the same cardinality as the count of
vCPUs for a domain. Iterating it can cause access beyond the end of the
array.

src/vz/vz_sdk.c

index b78c413877caac213e61b029d6d91f2a1e1bf856..d61097942270a1ed5d901d2d9efdacaf0e8d8fe2 100644 (file)
@@ -1958,7 +1958,7 @@ prlsdkCheckUnsupportedParams(PRL_HANDLE sdkdom, virDomainDefPtr def)
     }
 
     if (def->cputune.vcpupin) {
-        for (i = 0; i < virDomainDefGetVcpus(def); i++) {
+        for (i = 0; i < def->cputune.nvcpupin; i++) {
             if (!virBitmapEqual(def->cpumask,
                                 def->cputune.vcpupin[i]->cpumask)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,