diff options
author | Daniel Micay <danielmicay@gmail.com> | 2017-06-05 21:52:34 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-06-06 16:16:10 +0200 |
commit | 88a5b39b69ab1828fd4130e2baadd184109cea69 (patch) | |
tree | 0fc290d6955867bc16aa6752857eb836c1264de5 /drivers/staging/rts5208 | |
parent | 372bd1eb8484525832a3959cc0b878a7f01dd70b (diff) | |
download | linux-88a5b39b69ab1828fd4130e2baadd184109cea69.tar.bz2 |
staging/rts5208: Fix read overflow in memcpy
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@gmail.com>
[kees: wrote commit log]
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Wayne Porter <wporter82@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rts5208')
-rw-r--r-- | drivers/staging/rts5208/rtsx_scsi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/rts5208/rtsx_scsi.c b/drivers/staging/rts5208/rtsx_scsi.c index a95c5de1aa00..36b5a11f21d2 100644 --- 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, struct rtsx_chip *chip) 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; |