Re: [PATCH v2] selftests/powerpc: Fix strncpy usage

2018-06-26 Thread Breno Leitao
On 06/26/2018 02:24 AM, Michael Ellerman wrote: > Breno Leitao writes: > >> 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(),

Re: [PATCH v2] selftests/powerpc: Fix strncpy usage

2018-06-25 Thread Michael Ellerman
Breno Leitao writes: > 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

[PATCH v2] selftests/powerpc: Fix strncpy usage

2018-06-25 Thread Breno Leitao
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 allocates 'p