[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/26] qemu-io: Handle cvtnum() errors in 'alloc'
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 05/26] qemu-io: Handle cvtnum() errors in 'alloc' |
Date: |
Fri, 7 Jun 2013 13:58:24 +0200 |
From: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
qemu-io.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/qemu-io.c b/qemu-io.c
index 8a719a8..b4f56fc 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -1596,7 +1596,10 @@ static int alloc_f(int argc, char **argv)
int ret;
offset = cvtnum(argv[1]);
- if (offset & 0x1ff) {
+ if (offset < 0) {
+ printf("non-numeric offset argument -- %s\n", argv[1]);
+ return 0;
+ } else if (offset & 0x1ff) {
printf("offset %" PRId64 " is not sector aligned\n",
offset);
return 0;
@@ -1604,6 +1607,10 @@ static int alloc_f(int argc, char **argv)
if (argc == 3) {
nb_sectors = cvtnum(argv[2]);
+ if (nb_sectors < 0) {
+ printf("non-numeric length argument -- %s\n", argv[2]);
+ return 0;
+ }
} else {
nb_sectors = 1;
}
--
1.8.1.4
- [Qemu-devel] [PULL 00/26] Block patches, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 01/26] blockdev: reset werror/rerror on drive_del, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 02/26] qemu-io: Remove unused args_command, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 03/26] cutils: Support 'P' and 'E' suffixes in strtosz(), Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 04/26] qemu-io: Make cvtnum() a wrapper around strtosz_suffix(), Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 05/26] qemu-io: Handle cvtnum() errors in 'alloc',
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 06/26] qemu-io: Don't use global bs in command implementations, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 08/26] qemu-io: Factor out qemuio_command, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 09/26] qemu-io: Move 'help' function, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 11/26] qemu-io: Move qemu_strsep() to cutils.c, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 10/26] qemu-io: Move 'quit' function, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 07/26] qemu-io: Split off commands to qemu-io-cmds.c, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 12/26] qemu-io: Move functions for registering and running commands, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 13/26] qemu-io: Move command_loop() and friends, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 14/26] qemu-io: Move remaining helpers from cmd.c, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 15/26] qemu-io: Interface cleanup, Stefan Hajnoczi, 2013/06/07