projects
/
qemu
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update
[qemu]
/
block-cow.c
diff --git
a/block-cow.c
b/block-cow.c
index
15270df
..
eeeab70
100644
(file)
--- 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;
{
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
be32_to_cpu(cow_header->version) == COW_VERSION)
return 100;
else