The count of vCPUs for a domain is extracted as a usingned long variable
but is stored in a unsigned short. If the actual number was too large,
a faulty number was stored.
def->maxvcpus = 1;
} else {
def->maxvcpus = count;
- if (count == 0) {
+ if (count == 0 || (unsigned short) count != count) {
virReportError(VIR_ERR_XML_ERROR,
_("invalid maxvcpus %lu"), count);
goto error;
def->vcpus = def->maxvcpus;
} else {
def->vcpus = count;
- if (count == 0) {
+ if (count == 0 || (unsigned short) count != count) {
virReportError(VIR_ERR_XML_ERROR,
_("invalid current vcpus %lu"), count);
goto error;