mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-23 08:35:19 -05:00
Smack: prevent underflow in smk_set_cipso()
We have an upper bound on "maplevel" but forgot to check for negative
values.
Fixes: e114e47377
("Smack: Simplified Mandatory Access Control Kernel")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
This commit is contained in:
parent
a6bd4f6d9b
commit
42a2df3e82
1 changed files with 1 additions and 1 deletions
|
@ -884,7 +884,7 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf,
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sscanf(rule, "%d", &maplevel);
|
ret = sscanf(rule, "%d", &maplevel);
|
||||||
if (ret != 1 || maplevel > SMACK_CIPSO_MAXLEVEL)
|
if (ret != 1 || maplevel < 0 || maplevel > SMACK_CIPSO_MAXLEVEL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
rule += SMK_DIGITLEN;
|
rule += SMK_DIGITLEN;
|
||||||
|
|
Loading…
Reference in a new issue