1 Star 0 Fork 31

lujie/libsepol

forked from src-openEuler/libsepol 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-libsepol-add-check-for-category-value-before-printin.patch 1.33 KB
一键复制 编辑 原始数据 按行查看 历史
markeryang 提交于 2024-10-15 09:36 +08:00 . sync backport patches from upstream
From d3c2992ed0358c8e86a83c7f55fc529cba545298 Mon Sep 17 00:00:00 2001
From: Huaxin Lu <luhuaxin1@huawei.com>
Date: Thu, 16 Nov 2023 07:32:07 +0800
Subject: [PATCH] libsepol: add check for category value before printing
In mls_semantic_level_expand(), there is a explicitly determine
whether category is 0, which may cause an potential integer
overflow in error branch.
Signed-off-by: Huaxin Lu <luhuaxin1@huawei.com>
Acked-by: James Carter <jwcart2@gmail.com>
Reference: https://github.com/SELinuxProject/selinux/commit/d3c2992ed0358c8e86a83c7f55fc529cba545298
Conflict: NA
---
libsepol/src/expand.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libsepol/src/expand.c b/libsepol/src/expand.c
index ee5f9185..e63414b1 100644
--- a/libsepol/src/expand.c
+++ b/libsepol/src/expand.c
@@ -945,8 +945,8 @@ int mls_semantic_level_expand(mls_semantic_level_t * sl, mls_level_t * l,
for (cat = sl->cat; cat; cat = cat->next) {
if (!cat->low || cat->low > cat->high) {
ERR(h, "Category range is not valid %s.%s",
- p->p_cat_val_to_name[cat->low - 1],
- p->p_cat_val_to_name[cat->high - 1]);
+ cat->low > 0 ? p->p_cat_val_to_name[cat->low - 1] : "Invalid",
+ cat->high > 0 ? p->p_cat_val_to_name[cat->high - 1] : "Invalid");
return -1;
}
for (i = cat->low - 1; i < cat->high; i++) {
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lujie42/libsepol.git
git@gitee.com:lujie42/libsepol.git
lujie42
libsepol
libsepol
master

搜索帮助