diff options
author | 2010-08-02 21:20:26 +0200 | |
---|---|---|
committer | 2010-08-02 21:20:26 +0200 | |
commit | b259bab8e737349b0d2eb4259ced2484dcd4bee9 (patch) | |
tree | 61c26122e4d75cb8a5428ed7db3ac1ad8bb8b1a2 | |
parent | Add iptables rule to fixup DHCP response checksum. (diff) | |
download | libvirt-b259bab8e737349b0d2eb4259ced2484dcd4bee9.tar.gz libvirt-b259bab8e737349b0d2eb4259ced2484dcd4bee9.tar.bz2 libvirt-b259bab8e737349b0d2eb4259ced2484dcd4bee9.zip |
Make virsh -d check its input
it was using atoi direct without checking leading to confusion
in case of flag error for example with -c
* tools/virsh.c: vshParseArgv() use virStrToLong_i and remove the
unchecked atoi used to parse teh parameter
-rw-r--r-- | tools/virsh.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/virsh.c b/tools/virsh.c index 354feb0c2..926652a26 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -11021,7 +11021,10 @@ vshParseArgv(vshControl *ctl, int argc, char **argv) while ((arg = getopt_long(end, argv, "d:hqtc:vrl:", opt, &idx)) != -1) { switch (arg) { case 'd': - ctl->debug = atoi(optarg); + if (virStrToLong_i(optarg, NULL, 10, &ctl->debug) < 0) { + vshError(ctl, _("option -d takes a numeric argument"), arg); + exit(EXIT_FAILURE); + } break; case 'h': help = 1; |