Skip to content

Commit a6bd4f6

Browse files
Dan Carpentercschaufler
authored andcommitted
Smack: fix another vsscanf out of bounds
This is similar to commit 84e99e5 ("Smack: slab-out-of-bounds in vsscanf") where we added a bounds check on "rule". Reported-by: [email protected] Fixes: f7112e6 ("Smack: allow for significantly longer Smack labels v4") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Casey Schaufler <[email protected]>
1 parent beb4ee6 commit a6bd4f6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

security/smack/smackfs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,10 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf,
905905

906906
for (i = 0; i < catlen; i++) {
907907
rule += SMK_DIGITLEN;
908+
if (rule > data + count) {
909+
rc = -EOVERFLOW;
910+
goto out;
911+
}
908912
ret = sscanf(rule, "%u", &cat);
909913
if (ret != 1 || cat > SMACK_CIPSO_MAXCATNUM)
910914
goto out;

0 commit comments

Comments
 (0)