Hi Because virsh vcpupin does not check a form of <cpumap>, when non-numerical letters are set, it does not become an error. This patch fixes it so that it become an error when non-numerical letters are set. Signed-off-by: Masayuki Sunou <fj1826dm@xxxxxxxxxxxxxxxxx> Thanks, Masayuki Sunou. ---------------------------------------------------------------------- Index: src/virsh.c =================================================================== RCS file: /data/cvs/libvirt/src/virsh.c,v retrieving revision 1.84 diff -u -p -r1.84 virsh.c --- src/virsh.c 15 Jun 2007 15:24:20 -0000 1.84 +++ src/virsh.c 18 Jun 2007 07:02:31 -0000 @@ -1530,6 +1530,7 @@ cmdVcpupin(vshControl * ctl, vshCmd * cm int vcpufound = 0; unsigned char *cpumap; int cpumaplen; + int i; if (!vshConnectionUsability(ctl, ctl->conn, TRUE)) return FALSE; @@ -1563,6 +1564,22 @@ cmdVcpupin(vshControl * ctl, vshCmd * cm return FALSE; } + for(i = 0; cpulist[i]; i++) { + if ((i == 0) || (i == strlen(cpulist)-1)) { + if (!isdigit(cpulist[i])) { + vshError(ctl, FALSE, _("Invalid format '%s'."), cpulist); + virDomainFree(dom); + return FALSE; + } + } else { + if(!isdigit(cpulist[i]) && cpulist[i] != ',') { + vshError(ctl, FALSE, _("Invalid format '%s'."), cpulist); + virDomainFree(dom); + return FALSE; + } + } + } + cpumaplen = VIR_CPU_MAPLEN(VIR_NODEINFO_MAXCPUS(nodeinfo)); cpumap = vshCalloc(ctl, 1, cpumaplen); ----------------------------------------------------------------------