staging: wilc1000: prevent some overflows in debugfs
Subsystems (2)
PATCH 1/1 staging: wilc1000: prevent some overflows in debugfs
Add some limits here so we don't corrupt memory.
Signed-off-by Dan Carpenter <[email protected]>
drivers/staging/wilc1000/wilc_debugfs.c +6 -0
@@ -53,6 +53,9 @@ static ssize_t wilc_debug_level_write(struct file *filp, const char *buf, size_tchar 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 ; }