• Breno Leitao's avatar
    selftests/powerpc: Fix strncpy usage · 09a61e89
    Breno Leitao authored
    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.
    Signed-off-by: default avatarBreno Leitao <leitao@debian.org>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    09a61e89
dscr_inherit_exec_test.c 2.4 KB