OSDN Git Service

staging/rts5208: Fix read overflow in memcpy
authorDaniel Micay <danielmicay@gmail.com>
Tue, 6 Jun 2017 04:52:34 +0000 (21:52 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Sep 2018 20:47:11 +0000 (22:47 +0200)
commit21a9426de89ecc1a459933ee39e36dfed81f8a24
tree4a69e48a8e85509372c0d2e3c194970abb7de9a3
parent11e085a7b9e8b4020e7882eeff785603a55f7d43
staging/rts5208: Fix read overflow in memcpy

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@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: Amit Pundir <amit.pundir@linaro.org>
drivers/staging/rts5208/rtsx_scsi.c