[S390] sclp_async: potential buffer overflow

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, April 9, 2010 - 11:59 am

Gitweb:     http://git.kernel.org/linus/35ac734f72d846f250c0344913a91f954ea764c3
Commit:     35ac734f72d846f250c0344913a91f954ea764c3
Parent:     d7015c120e0ac55d86cabbe7a14997b99f39e282
Author:     Dan Carpenter <error27@gmail.com>
AuthorDate: Fri Apr 9 13:42:59 2010 +0200
Committer:  Martin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>
CommitDate: Fri Apr 9 13:43:02 2010 +0200

    [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>
---
 drivers/s390/char/sclp_async.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/s390/char/sclp_async.c b/drivers/s390/char/sclp_async.c
index 2aecf7f..7ad30e7 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)
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[S390] sclp_async: potential buffer overflow, Linux Kernel Mailing ..., (Fri Apr 9, 11:59 am)