[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL v2 32/40] qemu-io: Check for trailing chars
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL v2 32/40] qemu-io: Check for trailing chars |
Date: |
Tue, 10 Nov 2015 15:09:32 +0100 |
From: John Snow <address@hidden>
Make sure there's not trailing garbage, e.g.
"64k-whatever-i-want-here"
Reported-by: Max Reitz <address@hidden>
Signed-off-by: John Snow <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
qemu-io-cmds.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index 20605f2..238b1da 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -136,7 +136,14 @@ static char **breakline(char *input, int *count)
static int64_t cvtnum(const char *s)
{
char *end;
- return qemu_strtosz_suffix(s, &end, QEMU_STRTOSZ_DEFSUFFIX_B);
+ int64_t ret;
+
+ ret = qemu_strtosz_suffix(s, &end, QEMU_STRTOSZ_DEFSUFFIX_B);
+ if (*end != '\0') {
+ /* Detritus at the end of the string */
+ return -EINVAL;
+ }
+ return ret;
}
#define EXABYTES(x) ((long long)(x) << 60)
--
1.8.3.1
- [Qemu-block] [PULL v2 20/40] block: add a 'blockdev-snapshot' QMP command, (continued)
- [Qemu-block] [PULL v2 20/40] block: add a 'blockdev-snapshot' QMP command, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 21/40] block: add tests for the 'blockdev-snapshot' command, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 22/40] commit: reopen overlay_bs before base, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 23/40] qemu-iotests: Test the reopening of overlay_bs in 'block-commit', Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 26/40] throttle: Check for pending requests in throttle_group_unregister_bs(), Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 24/40] qcow2: avoid misaligned 64bit bswap, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 27/40] throttle: Use bs->throttle_state instead of bs->io_limits_enabled, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 25/40] qemu-img: add check for zero-length job len, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 29/40] block: Remove inner quotation marks in iotest 085, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 28/40] block: Disallow snapshots if the overlay doesn't support backing files, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 32/40] qemu-io: Check for trailing chars,
Kevin Wolf <=
- [Qemu-block] [PULL v2 31/40] qemu-io: fix cvtnum lval types, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 36/40] mirror: block all operations on the target image during the job, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 30/40] block: test 'blockdev-snapshot' using a file BDS as the overlay, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 34/40] qemu-iotests: fix cleanup of background processes, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 33/40] qemu-io: Correct error messages, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 35/40] qemu-iotests: fix -valgrind option for check, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 37/40] block: Add blk_get_refcnt(), Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 39/40] iotests: Add tests for the x-blockdev-del command, Kevin Wolf, 2015/11/10