Re: [PATCH bpf-next] bpf: use the proper optlen when doing strncpy in bpf_getsockopt()

2019-01-23 Thread Daniel Borkmann
On 01/22/2019 07:04 PM, Martin Lau wrote: > On Sat, Jan 19, 2019 at 02:20:52PM +0800, Yafang Shao wrote: >> As the last character of optval will be set with 0, so just copying >> (optlen - 1) characters is enough. > I am not sure this optimization is needed but I think it will Yeah, it's totally f

Re: [PATCH bpf-next] bpf: use the proper optlen when doing strncpy in bpf_getsockopt()

2019-01-22 Thread Lawrence Brakmo
On 1/22/19, 10:05 AM, "Martin Lau" wrote: On Sat, Jan 19, 2019 at 02:20:52PM +0800, Yafang Shao wrote: > As the last character of optval will be set with 0, so just copying > (optlen - 1) characters is enough. I am not sure this optimization is needed but I think it will make

Re: [PATCH bpf-next] bpf: use the proper optlen when doing strncpy in bpf_getsockopt()

2019-01-22 Thread Martin Lau
On Sat, Jan 19, 2019 at 02:20:52PM +0800, Yafang Shao wrote: > As the last character of optval will be set with 0, so just copying > (optlen - 1) characters is enough. I am not sure this optimization is needed but I think it will make it more consistent with the bpf_setsockopt() above. Acked-by: M

[PATCH bpf-next] bpf: use the proper optlen when doing strncpy in bpf_getsockopt()

2019-01-18 Thread Yafang Shao
As the last character of optval will be set with 0, so just copying (optlen - 1) characters is enough. Signed-off-by: Yafang Shao --- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/filter.c b/net/core/filter.c index 447dd1b..7a4de22 100644 --- a/ne