[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1371730497.3252.400.camel@edumazet-glaptop>
Date: Thu, 20 Jun 2013 05:14:57 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Zhao Hongjiang <zhaohongjiang@...wei.com>
Cc: davem@...emloft.net, kuznet@....inr.ac.ru, jmorris@...ei.org,
yoshfuji@...ux-ipv6.org, kaber@...sh.net, netdev@...r.kernel.org
Subject: Re: [PATCH 1/5] net: ipv4: using strlcpy instead of strncpy
On Thu, 2013-06-20 at 18:49 +0800, Zhao Hongjiang wrote:
> for NUL terminated string, need alway set '\0' in the end.
>
> Signed-off-by: Zhao Hongjiang <zhaohongjiang@...wei.com>
> ---
> net/ipv4/tcp_cong.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
> index 019c238..3280234 100644
> --- a/net/ipv4/tcp_cong.c
> +++ b/net/ipv4/tcp_cong.c
> @@ -170,7 +170,7 @@ void tcp_get_default_congestion_control(char *name)
>
> rcu_read_lock();
> ca = list_entry(tcp_cong_list.next, struct tcp_congestion_ops, list);
> - strncpy(name, ca->name, TCP_CA_NAME_MAX);
> + strlcpy(name, ca->name, sizeof(name));
> rcu_read_unlock();
> }
>
You are quite mistaken.
How did you test this patch exactly ?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists