[PATCH] selftests/powerpc: Fix strncpy usage
Segher Boessenkool
segher at kernel.crashing.org
Sat Jun 23 11:00:23 AEST 2018
On Fri, Jun 22, 2018 at 04:51:21PM +0200, Christophe LEROY wrote:
> Le 22/06/2018 à 16:43, Breno Leitao a écrit :
> >+ fprintf(stderr, "Very big executable name: %s\n", argv[0]);
> >+ return 1;
> >+ }
> >+
> >+ strncpy(prog, argv[0], sizeof(prog) - 1);
>
> You have checked before that argv[0] is not too long, so you should not
> need to use strncpy(), strcpy() would do it.
If you don't care about the bytes of prog after the first zero byte, sure.
Segher
More information about the Linuxppc-dev
mailing list