From 35ac734f72d846f250c0344913a91f954ea764c3 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 9 Apr 2010 13:42:59 +0200 Subject: [PATCH] [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 Signed-off-by: Martin Schwidefsky --- drivers/s390/char/sclp_async.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/s390/char/sclp_async.c b/drivers/s390/char/sclp_async.c index 2aecf7f21361..7ad30e72f868 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)