neil / rpms / libblockdev

Forked from rpms/libblockdev a year ago
Clone

Blame SOURCES/0001-crypto-Fix-GError-overwrite-from-libvolume_key.patch

dc5839
From 7a0e344d0642f76992c943158621d8ee7e5caea3 Mon Sep 17 00:00:00 2001
dc5839
From: Vojtech Trefny <vtrefny@redhat.com>
dc5839
Date: Tue, 15 Nov 2022 13:21:25 +0100
dc5839
Subject: [PATCH 1/2] crypto: Fix GError overwrite from libvolume_key
dc5839
dc5839
---
dc5839
 src/plugins/crypto.c | 7 ++++---
dc5839
 1 file changed, 4 insertions(+), 3 deletions(-)
dc5839
dc5839
diff --git a/src/plugins/crypto.c b/src/plugins/crypto.c
dc5839
index 35c38410..9064c8e3 100644
dc5839
--- a/src/plugins/crypto.c
dc5839
+++ b/src/plugins/crypto.c
dc5839
@@ -2552,13 +2552,14 @@ static gboolean write_escrow_data_file (struct libvk_volume *volume, struct libv
dc5839
     GIOChannel *out_file = NULL;
dc5839
     GIOStatus status = G_IO_STATUS_ERROR;
dc5839
     gsize bytes_written = 0;
dc5839
+    GError *l_error = NULL;
dc5839
 
dc5839
     packet_data = libvk_volume_create_packet_asymmetric_with_format (volume, &packet_data_size, secret_type, cert,
dc5839
-                                                                     ui, LIBVK_PACKET_FORMAT_ASYMMETRIC_WRAP_SECRET_ONLY, error);
dc5839
-
dc5839
+                                                                     ui, LIBVK_PACKET_FORMAT_ASYMMETRIC_WRAP_SECRET_ONLY, &l_error);
dc5839
     if (!packet_data) {
dc5839
         g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_ESCROW_FAILED,
dc5839
-                     "Failed to get escrow data");
dc5839
+                     "Failed to get escrow data: %s", l_error->message);
dc5839
+        g_clear_error (&l_error);
dc5839
         libvk_volume_free (volume);
dc5839
         return FALSE;
dc5839
     }
dc5839
-- 
dc5839
2.38.1
dc5839
dc5839
dc5839
From 25bf34c4c03e37eb3782dfccf459b9a3f795ddb3 Mon Sep 17 00:00:00 2001
dc5839
From: Vojtech Trefny <vtrefny@redhat.com>
dc5839
Date: Wed, 16 Nov 2022 10:26:06 +0100
dc5839
Subject: [PATCH 2/2] crypto: Fix double free in write_escrow_data_file
dc5839
dc5839
---
dc5839
 src/plugins/crypto.c | 1 -
dc5839
 1 file changed, 1 deletion(-)
dc5839
dc5839
diff --git a/src/plugins/crypto.c b/src/plugins/crypto.c
dc5839
index 9064c8e3..2086209e 100644
dc5839
--- a/src/plugins/crypto.c
dc5839
+++ b/src/plugins/crypto.c
dc5839
@@ -2560,7 +2560,6 @@ static gboolean write_escrow_data_file (struct libvk_volume *volume, struct libv
dc5839
         g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_ESCROW_FAILED,
dc5839
                      "Failed to get escrow data: %s", l_error->message);
dc5839
         g_clear_error (&l_error);
dc5839
-        libvk_volume_free (volume);
dc5839
         return FALSE;
dc5839
     }
dc5839
 
dc5839
-- 
dc5839
2.38.1
dc5839