[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 04/16] qemu-io: Handle cvtnum() errors in 'alloc'
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 04/16] qemu-io: Handle cvtnum() errors in 'alloc' |
Date: |
Tue, 28 May 2013 17:27:24 +0200 |
Signed-off-by: Kevin Wolf <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] [PATCH 00/16] Make qemu-io commands available in the monitor, Kevin Wolf, 2013/05/28
- [Qemu-devel] [PATCH 01/16] qemu-io: Remove unused args_command, Kevin Wolf, 2013/05/28
- [Qemu-devel] [PATCH 02/16] cutils: Support 'P' and 'E' suffixes in strtosz(), Kevin Wolf, 2013/05/28
- [Qemu-devel] [PATCH 03/16] qemu-io: Make cvtnum() a wrapper around strtosz_suffix(), Kevin Wolf, 2013/05/28
- [Qemu-devel] [PATCH 04/16] qemu-io: Handle cvtnum() errors in 'alloc',
Kevin Wolf <=
- [Qemu-devel] [PATCH 05/16] qemu-io: Don't use global bs in command implementations, Kevin Wolf, 2013/05/28
- [Qemu-devel] [PATCH 08/16] qemu-io: Move 'help' function, Kevin Wolf, 2013/05/28
- [Qemu-devel] [PATCH 07/16] qemu-io: Factor out qemuio_command, Kevin Wolf, 2013/05/28
- [Qemu-devel] [PATCH 09/16] qemu-io: Move 'quit' function, Kevin Wolf, 2013/05/28