6 Star 5 Fork 56

OpenHarmony/third_party_e2fsprogs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
0029-e2fsck-avoid-theoretical-null-dereference-in-end_pro.patch 1.49 KB
一键复制 编辑 原始数据 按行查看 历史
f房芷仪 提交于 2024-04-08 10:31 . e2fsprogs升级
From fdec633fd661e79b7b81e848b5699775328d70ae Mon Sep 17 00:00:00 2001
From: zhanchengbin <zhanchengbin1@huawei.com>
Date: Fri, 31 Dec 2021 15:43:10 +0800
Subject: e2fsck: avoid theoretical null dereference in end_problem_latch()
This should only happen if there is a programming bug, but better safe
than sorry.
Link: https://lore.kernel.org/r/9a9c6658-a8b3-794a-85df-c3bdf0470111@huawei.com
Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
e2fsck/problem.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index 46a74273..95f0ace8 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -2321,6 +2321,8 @@ int end_problem_latch(e2fsck_t ctx, int mask)
int answer = -1;
ldesc = find_latch(mask);
+ if (!ldesc)
+ return answer;
if (ldesc->end_message && (ldesc->flags & PRL_LATCHED)) {
clear_problem_context(&pctx);
answer = fix_problem(ctx, ldesc->end_message, &pctx);
@@ -2467,8 +2469,8 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
* Do special latch processing. This is where we ask the
* latch question, if it exists
*/
- if (ptr->flags & PR_LATCH_MASK) {
- ldesc = find_latch(ptr->flags & PR_LATCH_MASK);
+ if (ptr->flags & PR_LATCH_MASK &&
+ (ldesc = find_latch(ptr->flags & PR_LATCH_MASK)) != NULL) {
if (ldesc->question && !(ldesc->flags & PRL_LATCHED)) {
ans = fix_problem(ctx, ldesc->question, pctx);
if (ans == 1)
--
cgit
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony/third_party_e2fsprogs.git
git@gitee.com:openharmony/third_party_e2fsprogs.git
openharmony
third_party_e2fsprogs
third_party_e2fsprogs
master

搜索帮助