dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0204-blscfg-don-t-leak-bls_entry.filename.patch

d9d99f
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
d9d99f
From: Will Thompson <wjt@endlessm.com>
d9d99f
Date: Thu, 12 Jul 2018 10:59:10 +0100
d9d99f
Subject: [PATCH] blscfg: don't leak bls_entry.filename
d9d99f
d9d99f
Zeroing the bls_entry struct before calling grub_free() on one of its
d9d99f
fields is not going to work too well.
d9d99f
d9d99f
Signed-off-by: Will Thompson <wjt@endlessm.com>
d9d99f
---
d9d99f
 grub-core/commands/blscfg.c | 2 +-
d9d99f
 1 file changed, 1 insertion(+), 1 deletion(-)
d9d99f
d9d99f
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
d9d99f
index a45f40fe67e..11a356de81a 100644
d9d99f
--- a/grub-core/commands/blscfg.c
d9d99f
+++ b/grub-core/commands/blscfg.c
d9d99f
@@ -166,8 +166,8 @@ static void bls_free_entry(struct bls_entry *entry)
d9d99f
     }
d9d99f
 
d9d99f
   grub_free (entry->keyvals);
d9d99f
-  grub_memset (entry, 0, sizeof (*entry));
d9d99f
   grub_free (entry->filename);
d9d99f
+  grub_memset (entry, 0, sizeof (*entry));
d9d99f
   grub_free (entry);
d9d99f
 }
d9d99f