2020-08-10 20:01:43 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2020-03-17 11:37:40 +00:00
|
|
|
From: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
|
Date: Mon, 16 Mar 2020 13:51:45 +0100
|
2020-08-10 20:01:43 +00:00
|
|
|
Subject: [PATCH] blscfg: return NULL instead of a zero-length array in
|
2020-03-17 11:37:40 +00:00
|
|
|
bls_make_list()
|
|
|
|
|
|
|
|
The bls_make_list() function returns a list of all the values for a given
|
|
|
|
key and if there is none a NULL pointer should be returned. But currently
|
|
|
|
is returnin a zero-length array instead.
|
|
|
|
|
|
|
|
This makes the callers to wrongly assume that there are values for a key
|
|
|
|
and populate wrong menu entries. For example menu entries are populated
|
|
|
|
with an initrd command even if there is no initrd fiel in the BLS file.
|
|
|
|
|
|
|
|
Resolves: rhbz#1806022
|
|
|
|
|
|
|
|
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
|
---
|
|
|
|
grub-core/commands/blscfg.c | 6 ++++++
|
|
|
|
1 file changed, 6 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
|
|
|
|
index aa4e624905e..df6947f58cd 100644
|
|
|
|
--- a/grub-core/commands/blscfg.c
|
|
|
|
+++ b/grub-core/commands/blscfg.c
|
|
|
|
@@ -600,6 +600,12 @@ static char **bls_make_list (struct bls_entry *entry, const char *key, int *num)
|
|
|
|
list[nlist] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (!nlist)
|
|
|
|
+ {
|
|
|
|
+ grub_free (list);
|
|
|
|
+ return NULL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
if (num)
|
|
|
|
*num = nlist;
|
|
|
|
|