[PATCH] secilc: Use size_t for file sizes

James Carter <[email protected]> Mon, 3 Aug 2026 13:24:20 -0400
Newsgroups org.kernel.vger.selinux
Message-ID <[email protected]>
The programs secil2conf, secilc2tree, and secilc use uint32_t for
the value of the size of the input files being read. This could
lead to a file larger than 4 GiB being truncated, so use size_t
instead.

Signed-off-by: James Carter <[email protected]>
---
 secilc/secil2conf.c | 2 +-
 secilc/secil2tree.c | 2 +-
 secilc/secilc.c     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/secilc/secil2conf.c b/secilc/secil2conf.c
index 9c028656..8378aceb 100644
--- a/secilc/secil2conf.c
+++ b/secilc/secil2conf.c
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
 	FILE *file = NULL;
 	char *buffer = NULL;
 	struct stat filedata;
-	uint32_t file_size;
+	size_t file_size;
 	char *output = NULL;
 	struct cil_db *db = NULL;
 	int mls = -1;
diff --git a/secilc/secil2tree.c b/secilc/secil2tree.c
index 039d1524..e7238a94 100644
--- a/secilc/secil2tree.c
+++ b/secilc/secil2tree.c
@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
 	FILE *file = NULL;
 	char *buffer = NULL;
 	struct stat filedata;
-	uint32_t file_size;
+	size_t file_size;
 	char *output = NULL;
 	struct cil_db *db = NULL;
 	int preserve_tunables = 0;
diff --git a/secilc/secilc.c b/secilc/secilc.c
index 016ffef3..54a15767 100644
--- a/secilc/secilc.c
+++ b/secilc/secilc.c
@@ -88,7 +88,7 @@ int main(int argc, char *argv[])
 	FILE *file = NULL;
 	char *buffer = NULL;
 	struct stat filedata;
-	uint32_t file_size;
+	size_t file_size;
 	char *output = NULL;
 	char *filecontexts = NULL;
 	struct cil_db *db = NULL;
-- 
2.55.0