1 Star 0 Fork 100

ridedolphin/grub2

forked from src-openEuler/grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-util-resolve-Do-not-read-past-the-end-of-the-array-in-read_dep_list.patch 1.22 KB
一键复制 编辑 原始数据 按行查看 历史
From ddf47bdb042ab0ea52bc713b5f80cc48543f0469 Mon Sep 17 00:00:00 2001
From: Glenn Washburn <development@efficientek.com>
Date: Wed, 12 Jan 2022 20:55:00 -0600
Subject: util/resolve: Do not read past the end of the array in
read_dep_list()
If the last non-NULL byte of "buf" is not a white-space character (such as
when a read line is longer than the size of "buf"), then "p" will eventually
point to the byte after the last byte in "buf". After which "p" will be
dereferenced in the while conditional leading to an out of bounds read. Make
sure that "p" is inside "buf" before dereferencing it.
Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Conflict:NA
Reference:https://git.savannah.gnu.org/cgit/grub.git/commit?id=ddf47bdb042ab0ea52bc713b5f80cc48543f0469
---
util/resolve.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/resolve.c b/util/resolve.c
index 3e887d2..5e9afa1 100644
--- a/util/resolve.c
+++ b/util/resolve.c
@@ -102,7 +102,7 @@ read_dep_list (FILE *fp)
dep_list = dep;
/* Add dependencies. */
- while (*p)
+ while (p < (buf + sizeof (buf)) && *p)
{
struct mod_list *mod;
char *name;
--
cgit v1.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ridedolphin/grub2.git
git@gitee.com:ridedolphin/grub2.git
ridedolphin
grub2
grub2
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385