render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
d76c62
From 83452775d46c10e2a33c2727f6c5e1d6e22ebdfe Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <83452775d46c10e2a33c2727f6c5e1d6e22ebdfe@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Tue, 17 Mar 2020 17:12:44 +0100
d76c62
Subject: [PATCH] qemuBlockBitmapsHandleCommitStart: Fix allocation of string
d76c62
 list
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
Allocate space also for the terminating NULL.
d76c62
d76c62
Reported-by: Daniel P. Berrangé <berrange@redhat.com>
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
d76c62
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
d76c62
(cherry picked from commit 061057e75461814e36aad1e78e96363d373ac34b)
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1799013
d76c62
Message-Id: <562a7faef6100c757b5556592093382b016755bb.1584461519.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 src/qemu/qemu_block.c | 2 +-
d76c62
 1 file changed, 1 insertion(+), 1 deletion(-)
d76c62
d76c62
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
d76c62
index 099ceeb802..dad3e2317f 100644
d76c62
--- a/src/qemu/qemu_block.c
d76c62
+++ b/src/qemu/qemu_block.c
d76c62
@@ -3019,7 +3019,7 @@ qemuBlockBitmapsHandleCommitStart(virStorageSourcePtr topsrc,
d76c62
     if (!(entry = virHashLookup(blockNamedNodeData, basesrc->nodeformat)))
d76c62
         return 0;
d76c62
 
d76c62
-    bitmaplist = g_new0(char *, entry->nbitmaps);
d76c62
+    bitmaplist = g_new0(char *, entry->nbitmaps + 1);
d76c62
 
d76c62
     for (i = 0; i < entry->nbitmaps; i++) {
d76c62
         qemuBlockNamedNodeDataBitmapPtr bitmap = entry->bitmaps[i];
d76c62
-- 
d76c62
2.25.1
d76c62