mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-09 09:14:57 +00:00
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.
This commit is contained in:
parent
1414cc5fdd
commit
6f9432fcaf
@ -3025,7 +3025,7 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
|
|||||||
bool ret = true;
|
bool ret = true;
|
||||||
unsigned char *cpumap = NULL;
|
unsigned char *cpumap = NULL;
|
||||||
unsigned char *cpumaps = NULL;
|
unsigned char *cpumaps = NULL;
|
||||||
int cpumaplen;
|
size_t cpumaplen;
|
||||||
bool bit, lastbit, isInvert;
|
bool bit, lastbit, isInvert;
|
||||||
int i, cpu, lastcpu, maxcpu, ncpus;
|
int i, cpu, lastcpu, maxcpu, ncpus;
|
||||||
bool unuse = false;
|
bool unuse = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user