mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
smackfs: Prevent underflow in smk_set_cipso()
[ Upstream commit3ad49d37cf
] There is a upper bound to "catlen" but no lower bound to prevent negatives. I don't see that this necessarily causes a problem but we may as well be safe. Fixes:e114e47377
("Smack: Simplified Mandatory Access Control Kernel") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Casey Schaufler <casey@schaufler-ca.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
c364fa869b
commit
fcebe4cff6
@ -923,7 +923,7 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf,
|
||||
}
|
||||
|
||||
ret = sscanf(rule, "%d", &catlen);
|
||||
if (ret != 1 || catlen > SMACK_CIPSO_MAXCATNUM)
|
||||
if (ret != 1 || catlen < 0 || catlen > SMACK_CIPSO_MAXCATNUM)
|
||||
goto out;
|
||||
|
||||
if (format == SMK_FIXED24_FMT &&
|
||||
|
Loading…
Reference in New Issue
Block a user