Skip to contentSkip to conversation

secilc: Use size_t for file sizes

PATCH In review James Carter 2 participants 3 messages Aug 3 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 secilc: Use size_t for file sizes

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.

---
 secilc/secil2conf.c | 2 +-
 secilc/secil2tree.c | 2 +-
 secilc/secilc.c     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
secilc/secil2conf.c +1 -1
index 9c028656..8378aceb 100644
@@ -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;
secilc/secil2tree.c +1 -1
index 039d1524..e7238a94 100644
@@ -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;
secilc/secilc.c +1 -1
index 016ffef3..54a15767 100644
@@ -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;
Signature · 1 line
2.55.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · James Carter

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.

Quoted 48 lines
---
 secilc/secil2conf.c | 2 +-
 secilc/secil2tree.c | 2 +-
 secilc/secilc.c     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
secilc/secil2conf.c +1 -1
index 9c028656..8378aceb 100644
@@ -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;
secilc/secil2tree.c +1 -1
index 039d1524..e7238a94 100644
@@ -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;
secilc/secilc.c +1 -2
index 016ffef3..54a15767 100644
@@ -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