[PATCH] virsh: Back out if the argument for vol-create-as is malformed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 tools/virsh.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 4737948..4810627 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -11372,18 +11372,24 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd)
 
     if (vshCommandOptString(cmd, "capacity", &capacityStr) <= 0)
         goto cleanup;
-    if (vshVolSize(capacityStr, &capacity) < 0)
+
+    if (vshVolSize(capacityStr, &capacity) < 0) {
         vshError(ctl, _("Malformed size %s"), capacityStr);
+        goto cleanup;
+    }
 
     if (vshCommandOptString(cmd, "allocation", &allocationStr) > 0 &&
-        vshVolSize(allocationStr, &allocation) < 0)
+        vshVolSize(allocationStr, &allocation) < 0) {
         vshError(ctl, _("Malformed size %s"), allocationStr);
+        goto cleanup;
+    }
 
     if (vshCommandOptString(cmd, "format", &format) < 0 ||
         vshCommandOptString(cmd, "backing-vol", &snapshotStrVol) < 0 ||
         vshCommandOptString(cmd, "backing-vol-format",
                             &snapshotStrFormat) < 0) {
         vshError(ctl, "%s", _("missing argument"));
+        goto cleanup;
     }
 
 
-- 
1.7.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]