smackfs: restrict bytes count in smk_set_cipso()
[linux-2.6-microblaze.git] / security / smack / smackfs.c
index 66f3c53..3a75d2a 100644 (file)
@@ -855,6 +855,8 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf,
        if (format == SMK_FIXED24_FMT &&
            (count < SMK_CIPSOMIN || count > SMK_CIPSOMAX))
                return -EINVAL;
+       if (count > PAGE_SIZE)
+               return -EINVAL;
 
        data = memdup_user_nul(buf, count);
        if (IS_ERR(data))