summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--block-vmdk.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/block-vmdk.c b/block-vmdk.c
index af979a1e8e..9b5fb7346a 100644
--- a/block-vmdk.c
+++ b/block-vmdk.c
@@ -341,6 +341,8 @@ static int vmdk_parent_open(BlockDriverState *bs, const char * filename)
         p_name += sizeof("parentFileNameHint") + 1;
         if ((end_name = strchr(p_name,'\"')) == 0)
             return -1;
+        if ((end_name - p_name) > sizeof (s->hd->backing_file) - 1)
+            return -1;
 
         strncpy(s->hd->backing_file, p_name, end_name - p_name);
         if (stat(s->hd->backing_file, &file_buf) != 0) {