1 Star 0 Fork 20

lujie/libselinux

forked from src-openEuler/libselinux 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-libselinux-Fix-ordering-of-arguments-to-calloc.patch 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
fly_fzc 提交于 2024-03-25 19:11 +08:00 . backport upstream patches
From dfe30d9d0190ede292078d22ed45a160f331e1b6 Mon Sep 17 00:00:00 2001
From: James Carter <jwcart2@gmail.com>
Date: Fri, 5 Jan 2024 15:16:26 -0500
Subject: [PATCH] libselinux: Fix ordering of arguments to calloc
The number of elements should be first and the size of the elements
second.
Signed-off-by: James Carter <jwcart2@gmail.com>
Reference:https://github.com/SELinuxProject/selinux/commit/dfe30d9d0190ede292078d22ed45a160f331e1b6
Conflict:path adapt
---
src/audit2why.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/audit2why.c b/src/audit2why.c
index 8c4c07d5..ad846cc3 100644
--- a/src/audit2why.c
+++ b/src/audit2why.c
@@ -148,7 +148,7 @@ static int check_booleans(struct boolean_t **bools)
sepol_bool_free(boolean);
if (fcnt > 0) {
- *bools = calloc(sizeof(struct boolean_t), fcnt + 1);
+ *bools = calloc(fcnt + 1, sizeof(struct boolean_t));
if (!*bools) {
PyErr_SetString( PyExc_MemoryError, "Out of memory\n");
free(foundlist);
@@ -226,7 +226,7 @@ static int __policy_init(const char *init_path)
return 1;
}
- avc = calloc(sizeof(struct avc_t), 1);
+ avc = calloc(1, sizeof(struct avc_t));
if (!avc) {
PyErr_SetString( PyExc_MemoryError, "Out of memory\n");
fclose(fp);
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lujie42/libselinux.git
git@gitee.com:lujie42/libselinux.git
lujie42
libselinux
libselinux
master

搜索帮助