Skip to content

Commit

Permalink
staging: wilc1000: prevent some overflows in debugfs
Browse files Browse the repository at this point in the history
Add some limits here so we don't corrupt memory.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Jun 8, 2015
1 parent d35ebe8 commit 9ee8144
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/staging/wilc1000/wilc_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ static ssize_t wilc_debug_level_write(struct file *filp, const char *buf, size_t
char buffer[128] = {};
int flag = 0;

if (count > sizeof(buffer))
return -EINVAL;

if (copy_from_user(buffer, buf, count)) {
return -EFAULT;
}
Expand Down Expand Up @@ -99,6 +102,9 @@ static ssize_t wilc_debug_region_write(struct file *filp, const char *buf, size_
char buffer[128] = {};
int flag;

if (count > sizeof(buffer))
return -EINVAL;

if (copy_from_user(buffer, buf, count)) {
return -EFAULT;
}
Expand Down

0 comments on commit 9ee8144

Please sign in to comment.