mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-26 06:33:19 -04:00
staging: wilc1000: prevent some overflows in debugfs
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>
This commit is contained in:
parent
d35ebe8025
commit
9ee81443b9
1 changed files with 6 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue