Re: [PATCH] secilc: Use size_t for file sizes
Stephen Smalley <[email protected]> Mon, 3 Aug 2026 13:45:01 -0400
| Newsgroups | org.kernel.vger.selinux |
|---|---|
| Message-ID | <CAEjxPJ7h=AqMPVP21rp=bv6ymZRmXfgKvAPRqD0x-=SDCTGckQ@mail.gmail.com> |
On Mon, Aug 3, 2026 at 1:24=E2=80=AFPM James Carter <[email protected]> wro= te: > > 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]> Acked-by: Stephen Smalley <[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 =3D NULL; > char *buffer =3D NULL; > struct stat filedata; > - uint32_t file_size; > + size_t file_size; > char *output =3D NULL; > struct cil_db *db =3D NULL; > int mls =3D -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 =3D NULL; > char *buffer =3D NULL; > struct stat filedata; > - uint32_t file_size; > + size_t file_size; > char *output =3D NULL; > struct cil_db *db =3D NULL; > int preserve_tunables =3D 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 =3D NULL; > char *buffer =3D NULL; > struct stat filedata; > - uint32_t file_size; > + size_t file_size; > char *output =3D NULL; > char *filecontexts =3D NULL; > struct cil_db *db =3D NULL; > -- > 2.55.0 >