[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180917213828.314829677@linuxfoundation.org>
Date: Tue, 18 Sep 2018 00:41:41 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Daniel Micay <danielmicay@...il.com>,
Kees Cook <keescook@...omium.org>,
Wayne Porter <wporter82@...il.com>,
Amit Pundir <amit.pundir@...aro.org>
Subject: [PATCH 4.4 08/56] staging/rts5208: Fix read overflow in memcpy
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Micay <danielmicay@...il.com>
commit 88a5b39b69ab1828fd4130e2baadd184109cea69 upstream.
Noticed by FORTIFY_SOURCE, this swaps memcpy() for strncpy() to zero-value
fill the end of the buffer instead of over-reading a string from .rodata.
Signed-off-by: Daniel Micay <danielmicay@...il.com>
[kees: wrote commit log]
Signed-off-by: Kees Cook <keescook@...omium.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Wayne Porter <wporter82@...il.com>
Signed-off-by: Amit Pundir <amit.pundir@...aro.org>
---
drivers/staging/rts5208/rtsx_scsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/staging/rts5208/rtsx_scsi.c
+++ b/drivers/staging/rts5208/rtsx_scsi.c
@@ -536,7 +536,7 @@ static int inquiry(struct scsi_cmnd *srb
if (sendbytes > 8) {
memcpy(buf, inquiry_buf, 8);
- memcpy(buf + 8, inquiry_string, sendbytes - 8);
+ strncpy(buf + 8, inquiry_string, sendbytes - 8);
if (pro_formatter_flag) {
/* Additional Length */
buf[4] = 0x33;
Powered by blists - more mailing lists