ray_cs: Avoid reading past end of buffer
authorKees Cook <keescook@chromium.org>
Fri, 5 May 2017 22:38:41 +0000 (15:38 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Apr 2018 17:48:03 +0000 (19:48 +0200)
commit87aa297871ee0d05d45648ba647cb0ea0485884c
tree89f8953093bcba7204cf0f3632f30a4ceaaf3b10
parentcaead37e3aebbe1b3b9c11664fc9f102e35f42f7
ray_cs: Avoid reading past end of buffer

[ Upstream commit e48d661eb13f2f83861428f001c567fdb3f317e8 ]

Using memcpy() from a buffer that is shorter than the length copied means
the destination buffer is being filled with arbitrary data from the kernel
rodata segment. In this case, the source was made longer, since it did not
match the destination structure size. Additionally removes a needless cast.

This was found with the future CONFIG_FORTIFY_SOURCE feature.

Cc: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/ray_cs.c