mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-04-01 20:05:19 +00:00
xenapi: Use virStrToLong_i instead of sscanf for CPU map parsing
Parsing is stricter now and doesn't accept trailing characters after the actual value anymore.
This commit is contained in:
parent
1778da7185
commit
82cb2e73aa
@ -309,7 +309,7 @@ getCpuBitMapfromString(char *mask, unsigned char *cpumap, int maplen)
|
||||
bzero(cpumap, maplen);
|
||||
num = strtok_r(mask, ",", &bp);
|
||||
while (num != NULL) {
|
||||
if (sscanf(num, "%d", &pos) != 1)
|
||||
if (virStrToLong_i(num, NULL, 10, &pos) < 0)
|
||||
return;
|
||||
if (pos < 0 || pos > max_bits - 1)
|
||||
VIR_WARN ("number in str %d exceeds cpumap's max bits %d", pos, max_bits);
|
||||
|
Loading…
x
Reference in New Issue
Block a user