diff options
author | Kevin Wolf <kwolf@redhat.com> | 2018-03-20 18:24:54 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2018-03-26 12:17:43 +0200 |
commit | 6f16f7c5625fde5634cc4c40857b66cdee09dc17 (patch) | |
tree | ed4ca297d18f6d86757d10dff21ab16f064f0d76 /block/vhdx.c | |
parent | 0fcc38e7d0fb102ab9e9a9734459bdff89d3121f (diff) | |
download | qemu-6f16f7c5625fde5634cc4c40857b66cdee09dc17.zip qemu-6f16f7c5625fde5634cc4c40857b66cdee09dc17.tar.gz qemu-6f16f7c5625fde5634cc4c40857b66cdee09dc17.tar.bz2 |
vhdx: Check for 4 GB maximum log size on creation
It's unclear what the real maximum is, but we use an uint32_t to store
the log size in vhdx_co_create(), so we should check that the given
value fits in 32 bits.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Diffstat (limited to 'block/vhdx.c')
-rw-r--r-- | block/vhdx.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/block/vhdx.c b/block/vhdx.c index 4a087d8..6ac0424 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -1829,6 +1829,10 @@ static int coroutine_fn vhdx_co_create(BlockdevCreateOptions *opts, if (!vhdx_opts->has_log_size) { log_size = DEFAULT_LOG_SIZE; } else { + if (vhdx_opts->log_size > UINT32_MAX) { + error_setg(errp, "Log size must be smaller than 4 GB"); + return -EINVAL; + } log_size = vhdx_opts->log_size; } if (log_size < MiB || (log_size % MiB) != 0) { |