1 Star 0 Fork 99

src-NestOS/grub2

forked from src-openEuler/grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0199-blscfg-return-NULL-instead-of-a-zero-length-array-in.patch 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
hanzj0122_admin 提交于 2020-07-29 20:47 . update to 2.04
From 2b8388901cc52d875baa490a97dd314ef51ed0d9 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Mon, 16 Mar 2020 13:51:45 +0100
Subject: [PATCH 199/220] blscfg: return NULL instead of a zero-length array in
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 24e35a4..9263a5c 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;
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-nest-os/grub2.git
git@gitee.com:src-nest-os/grub2.git
src-nest-os
grub2
grub2
master

搜索帮助