Blob Blame History Raw
From 83452775d46c10e2a33c2727f6c5e1d6e22ebdfe Mon Sep 17 00:00:00 2001
Message-Id: <83452775d46c10e2a33c2727f6c5e1d6e22ebdfe@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 17 Mar 2020 17:12:44 +0100
Subject: [PATCH] qemuBlockBitmapsHandleCommitStart: Fix allocation of string
 list
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Allocate space also for the terminating NULL.

Reported-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 061057e75461814e36aad1e78e96363d373ac34b)
https://bugzilla.redhat.com/show_bug.cgi?id=1799013
Message-Id: <562a7faef6100c757b5556592093382b016755bb.1584461519.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/qemu/qemu_block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 099ceeb802..dad3e2317f 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3019,7 +3019,7 @@ qemuBlockBitmapsHandleCommitStart(virStorageSourcePtr topsrc,
     if (!(entry = virHashLookup(blockNamedNodeData, basesrc->nodeformat)))
         return 0;
 
-    bitmaplist = g_new0(char *, entry->nbitmaps);
+    bitmaplist = g_new0(char *, entry->nbitmaps + 1);
 
     for (i = 0; i < entry->nbitmaps; i++) {
         qemuBlockNamedNodeDataBitmapPtr bitmap = entry->bitmaps[i];
-- 
2.25.1