qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] block/vpc: check that the image has not been tr


From: Peter Lieven
Subject: Re: [Qemu-devel] [PATCH] block/vpc: check that the image has not been truncated
Date: Tue, 22 Oct 2013 09:26:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0

On 22.10.2013 08:59, Eric Blake wrote:
On 10/22/2013 07:43 AM, Peter Lieven wrote:
this adds a check that a dynamic VHD file has not been
accidently truncated (e.g. during transfer or upload).

Signed-off-by: Peter Lieven <address@hidden>
---
  block/vpc.c |    7 +++++++
  1 file changed, 7 insertions(+)

diff --git a/block/vpc.c b/block/vpc.c
index 1acc1d4..921364e 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -269,6 +269,13 @@ static int vpc_open(BlockDriverState *bs, QDict *options, 
int flags,
              }
          }
+ if (s->free_data_block_offset > bdrv_getlength(bs->file)) {
+            ret = -EINVAL;
+            fprintf(stderr, "block-vpc: free_data_block_offset points after"
+                            "the end of file. the image has been 
truncated.\n");
Why fprintf() instead of using the errp argument?
wasn't aware. a few lines earlier fprintf(stderr, ...) was used.

if the others are otherwise happy with the patch I will send a v2.

Peter




reply via email to

[Prev in Thread] Current Thread [Next in Thread]