From 712e78744e3a0332825a80298f38225b30dec88c Mon Sep 17 00:00:00 2001 From: bellard Date: Thu, 28 Apr 2005 21:09:32 +0000 Subject: probing fixes git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1425 c046a42c-6fe2-441c-8c8c-71466251a162 --- block-cow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'block-cow.c') 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 -- cgit v1.2.1