lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <12DA05DE-5CA3-4AC5-966C-E0C2B2BDC873@fb.com>
Date:   Tue, 22 Jan 2019 18:39:29 +0000
From:   Lawrence Brakmo <brakmo@...com>
To:     Martin Lau <kafai@...com>, Yafang Shao <laoar.shao@...il.com>
CC:     "ast@...nel.org" <ast@...nel.org>,
        "daniel@...earbox.net" <daniel@...earbox.net>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "shaoyafang@...iglobal.com" <shaoyafang@...iglobal.com>
Subject: Re: [PATCH bpf-next] bpf: use the proper optlen when doing strncpy in
 bpf_getsockopt()

On 1/22/19, 10:05 AM, "Martin Lau" <kafai@...com> 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 it more consistent with the bpf_setsockopt() above.
    
    Acked-by: Martin KaFai Lau <kafai@...com>
    
    Cc: Lawrence Brakmo <brakmo@...com>

Acked-by: Lawrence Brakmo <brakmo@...com>
    
    > 
    > Signed-off-by: Yafang Shao <laoar.shao@...il.com>
    > ---
    >  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/net/core/filter.c
    > +++ b/net/core/filter.c
    > @@ -4262,7 +4262,7 @@ static unsigned long bpf_xdp_copy(void *dst_buff, const void *src_buff,
    >  
    >  			if (!icsk->icsk_ca_ops || optlen <= 1)
    >  				goto err_clear;
    > -			strncpy(optval, icsk->icsk_ca_ops->name, optlen);
    > +			strncpy(optval, icsk->icsk_ca_ops->name, optlen - 1);
    >  			optval[optlen - 1] = 0;
    >  			break;
    >  		case TCP_SAVED_SYN:
    > -- 
    > 1.8.3.1
    > 
    

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ