summaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-04-09 13:42:59 +0200
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>2010-04-09 13:43:02 +0200
commit35ac734f72d846f250c0344913a91f954ea764c3 (patch)
tree6f86aeb8ecb387afce50eb36e9001a234479a586 /drivers/s390
parentd7015c120e0ac55d86cabbe7a14997b99f39e282 (diff)
[S390] sclp_async: potential buffer overflow
"len" hasn't been properly range checked so we shouldn't use it as an array offset. This can only be written to by root but it would still be annoying to accidentally write more than 3 characters and corrupt your memory. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/char/sclp_async.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/s390/char/sclp_async.c b/drivers/s390/char/sclp_async.c
index 2aecf7f2136..7ad30e72f86 100644
--- a/drivers/s390/char/sclp_async.c
+++ b/drivers/s390/char/sclp_async.c
@@ -85,7 +85,7 @@ static int proc_handler_callhome(struct ctl_table *ctl, int write,
rc = copy_from_user(buf, buffer, sizeof(buf));
if (rc != 0)
return -EFAULT;
- buf[len - 1] = '\0';
+ buf[sizeof(buf) - 1] = '\0';
if (strict_strtoul(buf, 0, &val) != 0)
return -EINVAL;
if (val != 0 && val != 1)