]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: qedf: Avoid reading past end of buffer
authorKees Cook <keescook@chromium.org>
Fri, 5 May 2017 22:42:55 +0000 (15:42 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 9 May 2017 02:07:48 +0000 (22:07 -0400)
commitb5a74c107a3ca84d001c59bcff53d23735dce43c
tree0e02757aef2592f535c754271fd7b441d9056dee
parent199a6d04bfac0bcecf40b93f59f4b4b64296495f
scsi: qedf: Avoid reading past end of buffer

Using memcpy() from a string that is shorter than the length copied
means the destination buffer is being filled with arbitrary data from
the kernel rodata segment. Instead, use strncpy() which will fill the
trailing bytes with zeros.

This was found with the future CONFIG_FORTIFY_SOURCE feature.

Cc: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Chad Dupuis <chad.dupuis@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qedf/qedf_main.c