[v3,1/2] selftests/powerpc: Fix strncpy usage

Michael Ellerman patch-notifications at ellerman.id.au
Wed Jul 11 23:24:14 AEST 2018


On Tue, 2018-06-26 at 13:20:12 UTC, Breno Leitao wrote:
> There is a buffer overflow in dscr_inherit_test.c test. In main(), strncpy()'s
> third argument is the length of the source, not the size of the destination
> buffer, which makes strncpy() behaves like strcpy(), causing a buffer overflow
> if argv[0] is bigger than LEN_MAX (100).
> 
> This patch maps 'prog' to the argv[0] memory region, removing the static
> allocation and the LEN_MAX size restriction.
> 
> CC: Michael Ellerman <mpe at ellerman.id.au>
> CC: Segher Boessenkool <segher at kernel.crashing.org>
> CC: Anshuman Khandual <khandual at linux.vnet.ibm.com>
> Signed-off-by: Breno Leitao <leitao at debian.org>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/09a61e894ac852fb063ee0b54fc513

cheers


More information about the Linuxppc-dev mailing list