render / rpms / libvirt

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