Re: [PATCH] bna: ethtool: Avoid reading past end of buffer

2017-05-08 Thread David Miller
From: Kees Cook Date: Fri, 5 May 2017 15:30:23 -0700 > 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. >

[PATCH] bna: ethtool: Avoid reading past end of buffer

2017-05-05 Thread Kees Cook
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.