提交 82cb2e73 编写于 作者: M Matthias Bolte

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.
上级 1778da71
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册