mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 03:50:24 +09:00
Smack: prevent underflow in smk_set_cipso()
[ Upstream commit42a2df3e82] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
@@ -907,7 +907,7 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf,
|
||||
}
|
||||
|
||||
ret = sscanf(rule, "%d", &maplevel);
|
||||
if (ret != 1 || maplevel > SMACK_CIPSO_MAXLEVEL)
|
||||
if (ret != 1 || maplevel < 0 || maplevel > SMACK_CIPSO_MAXLEVEL)
|
||||
goto out;
|
||||
|
||||
rule += SMK_DIGITLEN;
|
||||
|
||||
Reference in New Issue
Block a user