1 Star 0 Fork 46

庞庆 / grub2

forked from src-anolis-os / grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0251-Fix-menu-entry-selection-based-on-title.patch 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
geliwei 提交于 2022-04-13 15:15 . update to grub2-2.02-120.el8.src.rpm
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Fri, 30 Nov 2018 16:39:09 +0100
Subject: [PATCH] Fix menu entry selection based on title
The get_entry_number_helper() function assumes that there could be a set
of entries identifiers in a variable (i.e: as used in the fallback case)
so iterates over the string until it finds a space to get the first id.
But this should only be done for indexes or entries id, since the title
can contain spaces. In the case of title, the complete string should be
used to select a given entry.
Resolves: rhbz#1654936
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
grub-core/normal/menu.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
index 95f7abaf2..fc25c702f 100644
--- a/grub-core/normal/menu.c
+++ b/grub-core/normal/menu.c
@@ -217,14 +217,11 @@ get_entry_number_helper(grub_menu_t menu,
for (i = 0, e = menu->entry_list; e; i++)
{
- int l = 0;
- while (val[l] && !grub_isspace(val[l]))
- l++;
- if (menuentry_eq (e->title, val, l))
+ if (menuentry_eq (e->title, val, -1))
{
if (tail)
- *tail = val + l;
+ *tail = NULL;
return i;
}
e = e->next;
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/pang-qing/grub2.git
git@gitee.com:pang-qing/grub2.git
pang-qing
grub2
grub2
a8

搜索帮助

344bd9b3 5694891 D2dac590 5694891