Message ID | 5070f3eb-55e2-44db-a97d-41f9b9878c6d@moroto.mountain (mailing list archive) |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | smackfs: Prevent underflow in smk_set_cipso() | expand |
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 5590eaad241b..25f67d1b5c73 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c @@ -896,7 +896,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 &&
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: e114e473771c ("Smack: Simplified Mandatory Access Control Kernel") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> --- security/smack/smackfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)