Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67499265 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman
Browse files

Smack: fix another vsscanf out of bounds



[ Upstream commit a6bd4f6d9b07452b0b19842044a6c3ea384b0b88 ]

This is similar to commit 84e99e58e8d1 ("Smack: slab-out-of-bounds in
vsscanf") where we added a bounds check on "rule".

Reported-by: default avatar <syzbot+a22c6092d003d6fe1122@syzkaller.appspotmail.com>
Fixes: f7112e6c ("Smack: allow for significantly longer Smack labels v4")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 3a2cd06a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -905,6 +905,10 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf,

	for (i = 0; i < catlen; i++) {
		rule += SMK_DIGITLEN;
		if (rule > data + count) {
			rc = -EOVERFLOW;
			goto out;
		}
		ret = sscanf(rule, "%u", &cat);
		if (ret != 1 || cat > SMACK_CIPSO_MAXCATNUM)
			goto out;