diff mbox series

[v2,2/4] libsepol: adjust type for saturation check

Message ID 20231109135121.42380-2-cgzones@googlemail.com (mailing list archive)
State Accepted
Commit 44375cb4a21d
Delegated to: Petr Lautrbach
Headers show
Series [v2,1/4] libsepol: use str_read() where appropriate | expand

Commit Message

Christian Göttsche Nov. 9, 2023, 1:51 p.m. UTC
Change the type for the number of primary names in a symtab to uint32_t,
which conforms to the bytes read and the type used in the symtab.
The type is important for the saturation check via is_saturated(), since
it checks against -1 casted to the specific type.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
v2:
  Split from subsequent patch
---
 libsepol/src/policydb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libsepol/src/policydb.c b/libsepol/src/policydb.c
index f608aba4..bc7bc9dc 100644
--- a/libsepol/src/policydb.c
+++ b/libsepol/src/policydb.c
@@ -4120,8 +4120,8 @@  int policydb_read(policydb_t * p, struct policy_file *fp, unsigned verbose)
 {
 
 	unsigned int i, j, r_policyvers;
-	uint32_t buf[5];
-	size_t len, nprim, nel;
+	uint32_t buf[5], nprim;
+	size_t len, nel;
 	char *policydb_str;
 	const struct policydb_compat_info *info;
 	unsigned int policy_type, bufindex;