* [patch] staging: wilc1000: prevent some overflows in debugfs
@ 2015-06-04 8:59 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2015-06-04 8:59 UTC (permalink / raw)
To: kernel-janitors
Add some limits here so we don't corrupt memory.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c
index 74b9fd5..c328208 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -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;
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-06-04 8:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-04 8:59 [patch] staging: wilc1000: prevent some overflows in debugfs Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox