diff options
author | Casey Schaufler <casey@schaufler-ca.com> | 2020-04-09 16:35:28 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-06-20 10:24:12 +0200 |
commit | d9010023962a37eeaf1c75bdc5fcb15e235a5d1a (patch) | |
tree | 9d8ed02db0ed57ab27246da2f0498a53a9002515 | |
parent | 5317abc46279d900c7e63cc122682d819da658bd (diff) | |
download | linux-stable-d9010023962a37eeaf1c75bdc5fcb15e235a5d1a.tar.gz linux-stable-d9010023962a37eeaf1c75bdc5fcb15e235a5d1a.tar.bz2 linux-stable-d9010023962a37eeaf1c75bdc5fcb15e235a5d1a.zip |
Smack: slab-out-of-bounds in vsscanf
commit 84e99e58e8d1e26f04c097f4266e431a33987f36 upstream.
Add barrier to soob. Return -EOVERFLOW if the buffer
is exceeded.
Suggested-by: Hillf Danton <hdanton@sina.com>
Reported-by: syzbot+bfdd4a2f07be52351350@syzkaller.appspotmail.com
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | security/smack/smackfs.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 6492fe96cae4..3397b216bc6c 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c @@ -901,11 +901,21 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf, else rule += strlen(skp->smk_known) + 1; + if (rule > data + count) { + rc = -EOVERFLOW; + goto out; + } + ret = sscanf(rule, "%d", &maplevel); if (ret != 1 || maplevel > SMACK_CIPSO_MAXLEVEL) goto out; rule += SMK_DIGITLEN; + if (rule > data + count) { + rc = -EOVERFLOW; + goto out; + } + ret = sscanf(rule, "%d", &catlen); if (ret != 1 || catlen > SMACK_CIPSO_MAXCATNUM) goto out; |