From: Cédric Le Goater <c...@redhat.com>

qemu_uuid_unparse() includes a trailing NUL when writing the uuid
string and the buffer size should be UUID_FMT_LEN + 1 bytes. Use the
recently added UUID_STR_LEN which defines the correct size.

Fixes: CID 1522913
Fixes: 2dca1b37a760 ("vfio/pci: add support for VF token")
Cc: Alex Williamson <alex.william...@redhat.com>
Reviewed-by: Alex Williamson <alex.william...@redhat.com>
Reviewed-by: Juan Quintela <quint...@redhat.com>
Reviewed-by: "Denis V. Lunev" <d...@openvz.org>
Signed-off-by: Cédric Le Goater <c...@redhat.com>
(cherry picked from commit f8d6f3b16c37bd516a026e92a31dade5d761d3a6)
Signed-off-by: Michael Tokarev <m...@tls.msk.ru>

diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index a205c6b113..aab02ebb98 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -2987,7 +2987,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
     int groupid;
     int i, ret;
     bool is_mdev;
-    char uuid[UUID_FMT_LEN];
+    char uuid[UUID_STR_LEN];
     char *name;
 
     if (!vbasedev->sysfsdev) {
-- 
2.39.2


Reply via email to