diff options
Diffstat (limited to 'block-cow.c')
-rw-r--r-- | block-cow.c | 3 |
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 |