From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41Qft72J13zF35P for ; Wed, 11 Jul 2018 23:24:15 +1000 (AEST) In-Reply-To: <1530019213-2347-1-git-send-email-leitao@debian.org> To: Breno Leitao , linuxppc-dev@lists.ozlabs.org From: Michael Ellerman Cc: Breno Leitao , Anshuman Khandual Subject: Re: [v3,1/2] selftests/powerpc: Fix strncpy usage Message-Id: <41Qft64cJhzB4Mf@ozlabs.org> Date: Wed, 11 Jul 2018 23:24:14 +1000 (AEST) List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 > CC: Segher Boessenkool > CC: Anshuman Khandual > Signed-off-by: Breno Leitao Series applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/09a61e894ac852fb063ee0b54fc513 cheers