1 Star 0 Fork 31

lujie/libsepol

forked from src-openEuler/libsepol 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-libsepol-sepol_compute_sid-Do-not-destroy-uninitiali.patch 1.68 KB
一键复制 编辑 原始数据 按行查看 历史
据说名字用中文可以辟邪 提交于 2025-03-18 19:13 +08:00 . backport patches
From 1f080ffd7ab24b0ad2b46f79db63d62c2ae2747c Mon Sep 17 00:00:00 2001
From: Vit Mojzis <vmojzis@redhat.com>
Date: Fri, 19 Jul 2024 18:17:13 +0200
Subject: [PATCH] libsepol/sepol_compute_sid: Do not destroy uninitialized
context
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Avoid context_destroy() on "newcontext" before context_init() is called.
Fixes:
libsepol-3.6/src/services.c:1335: var_decl: Declaring variable "newcontext" without initializer.
libsepol-3.6/src/services.c:1462: uninit_use_in_call: Using uninitialized value "newcontext.range.level[0].cat.node" when calling "context_destroy".
\# 1460| rc = sepol_sidtab_context_to_sid(sidtab, &newcontext, out_sid);
\# 1461| out:
\# 1462|-> context_destroy(&newcontext);
\# 1463| return rc;
\# 1464| }
Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
Reviewed-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
---
libsepol/src/services.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/libsepol/src/services.c b/libsepol/src/services.c
index 36e2368f..f3231f17 100644
--- a/libsepol/src/services.c
+++ b/libsepol/src/services.c
@@ -1362,14 +1362,12 @@ static int sepol_compute_sid(sepol_security_id_t ssid,
scontext = sepol_sidtab_search(sidtab, ssid);
if (!scontext) {
ERR(NULL, "unrecognized SID %d", ssid);
- rc = -EINVAL;
- goto out;
+ return -EINVAL;
}
tcontext = sepol_sidtab_search(sidtab, tsid);
if (!tcontext) {
ERR(NULL, "unrecognized SID %d", tsid);
- rc = -EINVAL;
- goto out;
+ return -EINVAL;
}
if (tclass && tclass <= policydb->p_classes.nprim)
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lujie42/libsepol.git
git@gitee.com:lujie42/libsepol.git
lujie42
libsepol
libsepol
master

搜索帮助