aboutsummaryrefslogtreecommitdiff
path: root/block-cow.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-04-28 21:09:32 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-04-28 21:09:32 +0000
commit712e78744e3a0332825a80298f38225b30dec88c (patch)
treea2b59da7629b13843649281332fd0cf8be1267c2 /block-cow.c
parent7c35359cbf4eaa1d808a1ebb3647fe65fcc9dc60 (diff)
probing fixes
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1425 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block-cow.c')
-rw-r--r--block-cow.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/block-cow.c b/block-cow.c
index 15270dfd3f..eeeab7068b 100644
--- a/block-cow.c
+++ b/block-cow.c
@@ -54,7 +54,8 @@ static int cow_probe(const uint8_t *buf, int buf_size, const char *filename)
{
const struct cow_header_v2 *cow_header = (const void *)buf;
- if (be32_to_cpu(cow_header->magic) == COW_MAGIC &&
+ if (buf_size >= sizeof(struct cow_header_v2) &&
+ be32_to_cpu(cow_header->magic) == COW_MAGIC &&
be32_to_cpu(cow_header->version) == COW_VERSION)
return 100;
else