]> Git Repo - linux.git/commitdiff
Smack: fix another vsscanf out of bounds
authorDan Carpenter <[email protected]>
Thu, 23 Jul 2020 15:22:19 +0000 (18:22 +0300)
committerCasey Schaufler <[email protected]>
Mon, 27 Jul 2020 20:35:03 +0000 (13:35 -0700)
This is similar to commit 84e99e58e8d1 ("Smack: slab-out-of-bounds in
vsscanf") where we added a bounds check on "rule".

Reported-by: [email protected]
Fixes: f7112e6c9abf ("Smack: allow for significantly longer Smack labels v4")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Casey Schaufler <[email protected]>
security/smack/smackfs.c

index 840a192e93370d4fd11e1c11a70efa20c533fc61..2bae1fc493d163c81dce33b55cef432939b13718 100644 (file)
@@ -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;
This page took 0.065371 seconds and 4 git commands to generate.