mirror of
https://github.com/SELinuxProject/selinux
synced 2025-02-17 10:06:51 +00:00
libsepol: use correct type to avoid truncations
Avoid truncations of the read 32 bit unsigned integer: conditional.c:764:8: runtime error: implicit conversion from type 'uint32_t' (aka 'unsigned int') of value 3758096384 (32-bit, unsigned) to type 'int' changed the value to -536870912 (32-bit, signed) conditional.c:831:8: runtime error: implicit conversion from type 'uint32_t' (aka 'unsigned int') of value 4280295456 (32-bit, unsigned) to type 'int' changed the value to -14671840 (32-bit, signed) Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Acked-by: James Carter <jwcart2@gmail.com>
This commit is contained in:
parent
14f76201da
commit
4f1435dd51
@ -746,8 +746,8 @@ static int expr_isvalid(policydb_t * p, cond_expr_t * expr)
|
|||||||
|
|
||||||
static int cond_read_node(policydb_t * p, cond_node_t * node, void *fp)
|
static int cond_read_node(policydb_t * p, cond_node_t * node, void *fp)
|
||||||
{
|
{
|
||||||
uint32_t buf[2];
|
uint32_t buf[2], i, len;
|
||||||
int len, i, rc;
|
int rc;
|
||||||
cond_expr_t *expr = NULL, *last = NULL;
|
cond_expr_t *expr = NULL, *last = NULL;
|
||||||
|
|
||||||
rc = next_entry(buf, fp, sizeof(uint32_t));
|
rc = next_entry(buf, fp, sizeof(uint32_t));
|
||||||
@ -821,8 +821,8 @@ static int cond_read_node(policydb_t * p, cond_node_t * node, void *fp)
|
|||||||
int cond_read_list(policydb_t * p, cond_list_t ** list, void *fp)
|
int cond_read_list(policydb_t * p, cond_list_t ** list, void *fp)
|
||||||
{
|
{
|
||||||
cond_node_t *node, *last = NULL;
|
cond_node_t *node, *last = NULL;
|
||||||
uint32_t buf[1];
|
uint32_t buf[1], i, len;
|
||||||
int i, len, rc;
|
int rc;
|
||||||
|
|
||||||
rc = next_entry(buf, fp, sizeof(uint32_t));
|
rc = next_entry(buf, fp, sizeof(uint32_t));
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user