Re: [PATCH bpf-next] libbpf: fix GCC8 warning for strncpy

2019-07-02 Thread Andrii Nakryiko
On Mon, Jul 1, 2019 at 11:10 PM Y Song wrote: > > On Mon, Jul 1, 2019 at 10:47 PM Andrii Nakryiko wrote: > > > > GCC8 started emitting warning about using strncpy with number of bytes > > exactly equal destination size, which is generally unsafe, as can lead > > to non-zero terminated string bein

Re: [PATCH bpf-next] libbpf: fix GCC8 warning for strncpy

2019-07-02 Thread Magnus Karlsson
On Tue, Jul 2, 2019 at 8:10 AM Y Song wrote: > > On Mon, Jul 1, 2019 at 10:47 PM Andrii Nakryiko wrote: > > > > GCC8 started emitting warning about using strncpy with number of bytes > > exactly equal destination size, which is generally unsafe, as can lead > > to non-zero terminated string being

Re: [PATCH bpf-next] libbpf: fix GCC8 warning for strncpy

2019-07-01 Thread Y Song
On Mon, Jul 1, 2019 at 10:47 PM Andrii Nakryiko wrote: > > GCC8 started emitting warning about using strncpy with number of bytes > exactly equal destination size, which is generally unsafe, as can lead > to non-zero terminated string being copied. Use IFNAMSIZ - 1 as number > of bytes to ensure n

[PATCH bpf-next] libbpf: fix GCC8 warning for strncpy

2019-07-01 Thread Andrii Nakryiko
GCC8 started emitting warning about using strncpy with number of bytes exactly equal destination size, which is generally unsafe, as can lead to non-zero terminated string being copied. Use IFNAMSIZ - 1 as number of bytes to ensure name is always zero-terminated. Cc: Magnus Karlsson Signed-off-by