diff options
author | Eric Blake <eblake@redhat.com> | 2011-06-29 11:58:36 -0600 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2011-06-30 11:36:51 -0600 |
commit | 6f9432fcaf4c8836c7dc2cc60833a07760d821c4 (patch) | |
tree | e5558df1f4cd622f3e6f08d9e7127404076be3c7 | |
parent | Fix stream procedure number for virDomainMigratePrepareTunnel3 (diff) | |
download | libvirt-6f9432fcaf4c8836c7dc2cc60833a07760d821c4.tar.gz libvirt-6f9432fcaf4c8836c7dc2cc60833a07760d821c4.tar.bz2 libvirt-6f9432fcaf4c8836c7dc2cc60833a07760d821c4.zip |
virsh: avoid integer overflow
Detected by Coverity. info.nrVirtCpu is unsigned short, but if
cpumaplen is int, then the product of the two in vshMalloc risks
unintended sign extension. cmdVcpuinfo had already solved this
by using size_t cpumaplen.
* tools/virsh.c (cmdVcpuPin): Use correct type.
-rw-r--r-- | tools/virsh.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/virsh.c b/tools/virsh.c index e82ddae95..f96ee040d 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -3025,7 +3025,7 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd) bool ret = true; unsigned char *cpumap = NULL; unsigned char *cpumaps = NULL; - int cpumaplen; + size_t cpumaplen; bool bit, lastbit, isInvert; int i, cpu, lastcpu, maxcpu, ncpus; bool unuse = false; |