|
|
a41c76 |
From 914a920180c9803a57c06bd71f5270724c1dc900 Mon Sep 17 00:00:00 2001
|
|
|
a41c76 |
Message-Id: <914a920180c9803a57c06bd71f5270724c1dc900@dist-git>
|
|
|
a41c76 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
a41c76 |
Date: Fri, 20 Mar 2020 10:28:52 +0100
|
|
|
a41c76 |
Subject: [PATCH] virStorageEncryptionSecretCopy: Properly copy internals
|
|
|
a41c76 |
MIME-Version: 1.0
|
|
|
a41c76 |
Content-Type: text/plain; charset=UTF-8
|
|
|
a41c76 |
Content-Transfer-Encoding: 8bit
|
|
|
a41c76 |
|
|
|
a41c76 |
virStorageEncryptionSecretPtr may have a string inside it, thus we must
|
|
|
a41c76 |
copy the string too. Use virSecretLookupDefCopy to do that.
|
|
|
a41c76 |
|
|
|
a41c76 |
Caused by non-obvious code introduced in 756b46ddd24 and later 47e88b33b
|
|
|
a41c76 |
which added a string that needed to be copied.
|
|
|
a41c76 |
|
|
|
a41c76 |
https://bugzilla.redhat.com/show_bug.cgi?id=1814923
|
|
|
a41c76 |
|
|
|
a41c76 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
a41c76 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
a41c76 |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
a41c76 |
(cherry picked from commit 299796328c34a30295d6cdc7ebce5d65843e921f)
|
|
|
a41c76 |
Message-Id: <2e350bb771f75d9fd068f69a595401907d92ca33.1584696274.git.pkrempa@redhat.com>
|
|
|
a41c76 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
a41c76 |
---
|
|
|
a41c76 |
src/util/virstorageencryption.c | 8 +++-----
|
|
|
a41c76 |
1 file changed, 3 insertions(+), 5 deletions(-)
|
|
|
a41c76 |
|
|
|
a41c76 |
diff --git a/src/util/virstorageencryption.c b/src/util/virstorageencryption.c
|
|
|
a41c76 |
index 74836d4a00..6765fdc23a 100644
|
|
|
a41c76 |
--- a/src/util/virstorageencryption.c
|
|
|
a41c76 |
+++ b/src/util/virstorageencryption.c
|
|
|
a41c76 |
@@ -85,12 +85,10 @@ virStorageEncryptionFree(virStorageEncryptionPtr enc)
|
|
|
a41c76 |
static virStorageEncryptionSecretPtr
|
|
|
a41c76 |
virStorageEncryptionSecretCopy(const virStorageEncryptionSecret *src)
|
|
|
a41c76 |
{
|
|
|
a41c76 |
- virStorageEncryptionSecretPtr ret;
|
|
|
a41c76 |
-
|
|
|
a41c76 |
- if (VIR_ALLOC(ret) < 0)
|
|
|
a41c76 |
- return NULL;
|
|
|
a41c76 |
+ virStorageEncryptionSecretPtr ret = g_new0(virStorageEncryptionSecret, 1);
|
|
|
a41c76 |
|
|
|
a41c76 |
- memcpy(ret, src, sizeof(*src));
|
|
|
a41c76 |
+ ret->type = src->type;
|
|
|
a41c76 |
+ virSecretLookupDefCopy(&ret->seclookupdef, &src->seclookupdef);
|
|
|
a41c76 |
|
|
|
a41c76 |
return ret;
|
|
|
a41c76 |
}
|
|
|
a41c76 |
--
|
|
|
a41c76 |
2.25.1
|
|
|
a41c76 |
|