apparmor: store return value of unpack_perms_table() to signed variable
The unpack_perms_table() can return error which is negative value. Store the return value to a signed variable. policy->size is unsigned variable. It shouldn't be used to store the return status. Fixes: 2d6b2dea7f3c ("apparmor: add the ability for policy to specify a permission table") Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com> Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
parent
3249054168
commit
5515a8e30e
@ -734,14 +734,18 @@ static int unpack_pdb(struct aa_ext *e, struct aa_policydb *policy,
|
||||
{
|
||||
void *pos = e->pos;
|
||||
int i, flags, error = -EPROTO;
|
||||
ssize_t size;
|
||||
|
||||
policy->size = unpack_perms_table(e, &policy->perms);
|
||||
if (policy->size < 0) {
|
||||
error = policy->size;
|
||||
size = unpack_perms_table(e, &policy->perms);
|
||||
if (size < 0) {
|
||||
error = size;
|
||||
policy->perms = NULL;
|
||||
*info = "failed to unpack - perms";
|
||||
goto fail;
|
||||
} else if (policy->perms) {
|
||||
}
|
||||
policy->size = size;
|
||||
|
||||
if (policy->perms) {
|
||||
/* perms table present accept is index */
|
||||
flags = TO_ACCEPT1_FLAG(YYTD_DATA32);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user