X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=block-cow.c;h=eeeab7068b729a9bfe0b80cb635ccb1bc1f26982;hb=b195775fef3c221ff04e3091005e16c5745bf3c8;hp=15270dfd3fa720db82d8243ff8e3b9d18e45c22d;hpb=2b03a7a5bc4b23d912e0d8d23c8486ac8eec8a1d;p=qemu diff --git a/block-cow.c b/block-cow.c index 15270df..eeeab70 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