Non-digit characters were accepted in --cellno resulting in unwanted behavior: 'virsh freecell --cellno foo' wasn't rejected. --- This fix addresses bug 639587 tools/virsh.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index c2d165d..765566d 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -2283,7 +2283,7 @@ cmdFreecell(vshControl *ctl, const vshCmd *cmd) { int func_ret = FALSE; int ret; - int cell, cell_given; + int cell, cell_given, cellStr_given; unsigned long long memory; unsigned long long *nodes = NULL; int all_given; @@ -2295,6 +2295,13 @@ cmdFreecell(vshControl *ctl, const vshCmd *cmd) cell = vshCommandOptInt(cmd, "cellno", &cell_given); all_given = vshCommandOptBool(cmd, "all"); + vshCommandOptString(cmd, "cellno", &cellStr_given); + + if (cellStr_given && !cell_given) { + vshError(ctl, "%s", _("cell number must not contain any " + "non-digit characters.")); + goto cleanup; + } if (all_given && cell_given) { vshError(ctl, "%s", _("--cellno and --all are mutually exclusive. " -- 1.7.3.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list