From 83452775d46c10e2a33c2727f6c5e1d6e22ebdfe Mon Sep 17 00:00:00 2001 Message-Id: <83452775d46c10e2a33c2727f6c5e1d6e22ebdfe@dist-git> From: Peter Krempa 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é Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko Reviewed-by: Daniel P. Berrangé Tested-by: Daniel P. Berrangé (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 --- 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