]> xenbits.xensource.com Git - libvirt.git/commitdiff
xenapi: Use virStrToLong_i instead of sscanf for CPU map parsing
authorMatthias Bolte <matthias.bolte@googlemail.com>
Tue, 30 Mar 2010 14:51:04 +0000 (16:51 +0200)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 1 Apr 2010 10:53:41 +0000 (12:53 +0200)
Parsing is stricter now and doesn't accept trailing characters
after the actual value anymore.

src/xenapi/xenapi_utils.c

index 60e3c8d399640952e97a817792f2baaa29fdf683..581bd909ef60a5d456dfca31d510160b8fbd196f 100644 (file)
@@ -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);