Using of a incorrect value for the --holdtime option was silently
ignored and 0 was used. In case a negative number was used, it
overflowed as the API expects a unsigned int.
Fix the data type and getter function type and report errors on
incorrect values.
int ret = false;
const char *codeset_option;
int codeset;
- int holdtime;
+ unsigned int holdtime = 0;
int count = 0;
const vshCmdOpt *opt = NULL;
int keycode;
if (vshCommandOptString(cmd, "codeset", &codeset_option) <= 0)
codeset_option = "linux";
- if (vshCommandOptInt(cmd, "holdtime", &holdtime) <= 0)
- holdtime = 0;
+ if (vshCommandOptUInt(cmd, "holdtime", &holdtime) < 0) {
+ vshError(ctl, _("invalid value of --holdtime"));
+ goto cleanup;
+ }
codeset = virKeycodeSetTypeFromString(codeset_option);
if (codeset < 0) {