libselinux/backport-libselinux-Fix-ordering-of-arguments-to-calloc.patch
fly_fzc a0ce0a7214 backport upstream patches
(cherry picked from commit 2d65b8edc7d1afcb021fbac7cc381fbfa33df3c2)
2024-03-26 16:06:25 +08:00

43 lines
1.2 KiB
Diff

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