--- libvirt.orig/src/virsh.c 2007-07-07 00:05:19.000000000 +0900 +++ libvirt/src/virsh.c 2007-07-17 18:21:22.000000000 +0900 @@ -1024,9 +1024,21 @@ cmdSchedinfo(vshControl * ctl, vshCmd * /* Currently supports Xen Credit only */ weight = vshCommandOptInt(cmd, "weight", &weightfound); + if ( weightfound != 0 && (weight < 1 || weight > USHRT_MAX )) + { + weightfound = 0; + vshError(ctl, FALSE, + _("weight parameter (%d) is out of range (1-65535)."), weight); + } if (weightfound) nr_inputparams++; cap = vshCommandOptInt(cmd, "cap", &capfound); + if ( capfound != 0 && ( cap < 0 || cap > USHRT_MAX )) + { + capfound = 0; + vshError(ctl, FALSE, + _("cap parameter (%d) is out of range (0-65535)."), cap); + } if (capfound) nr_inputparams++; params = vshMalloc(ctl, sizeof (virSchedParameter) * nr_inputparams);