[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200619141652.833796545@linuxfoundation.org>
Date: Fri, 19 Jun 2020 16:31:07 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Hillf Danton <hdanton@...a.com>,
syzbot+bfdd4a2f07be52351350@...kaller.appspotmail.com,
Casey Schaufler <casey@...aufler-ca.com>
Subject: [PATCH 4.19 082/267] Smack: slab-out-of-bounds in vsscanf
From: Casey Schaufler <casey@...aufler-ca.com>
commit 84e99e58e8d1e26f04c097f4266e431a33987f36 upstream.
Add barrier to soob. Return -EOVERFLOW if the buffer
is exceeded.
Suggested-by: Hillf Danton <hdanton@...a.com>
Reported-by: syzbot+bfdd4a2f07be52351350@...kaller.appspotmail.com
Signed-off-by: Casey Schaufler <casey@...aufler-ca.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
security/smack/smackfs.c | 10 ++++++++++
1 file changed, 10 insertions(+)
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -906,11 +906,21 @@ static ssize_t smk_set_cipso(struct file
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;
Powered by blists - more mailing lists