diff options
author | Casey Schaufler <casey@schaufler-ca.com> | 2020-04-10 01:35:28 +0200 |
---|---|---|
committer | Casey Schaufler <casey@schaufler-ca.com> | 2020-05-06 23:46:26 +0200 |
commit | 84e99e58e8d1e26f04c097f4266e431a33987f36 (patch) | |
tree | 5df5e8a1d8ee64a1d9eb1ffec91a1e2c354cc61d /security | |
parent | smack: remove redundant structure variable from header. (diff) | |
download | linux-84e99e58e8d1e26f04c097f4266e431a33987f36.tar.xz linux-84e99e58e8d1e26f04c097f4266e431a33987f36.zip |
Smack: slab-out-of-bounds in vsscanf
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>
Diffstat (limited to 'security')
-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 e3e05c04dbd1..c21b656b3263 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c @@ -878,11 +878,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; |