vvfat: initialize memory after allocating it
authorHervé Poussineau <hpoussin@reactos.org>
Sat, 15 Jul 2017 13:28:41 +0000 (15:28 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 18 Jul 2017 13:14:36 +0000 (15:14 +0200)
This prevents some host to guest memory content leaks.

Fixes: https://bugs.launchpad.net/qemu/+bug/1599539
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/vvfat.c

index ea7775f432fd134df6bd80a9d180404b76cba1e3..6b11596abfe0990d596eaaf4fc4ca426c72b678c 100644 (file)
@@ -115,6 +115,7 @@ static inline int array_ensure_allocated(array_t* array, int index)
         array->pointer = g_realloc(array->pointer, new_size);
         if (!array->pointer)
             return -1;
+        memset(array->pointer + array->size, 0, new_size - array->size);
         array->size = new_size;
         array->next = index + 1;
     }