From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sultan Alsawaf Subject: [PATCH] ip_tunnel: Fix name string concatenate in __ip_tunnel_create() Date: Wed, 6 Jun 2018 15:56:54 -0700 Message-ID: <20180606225654.7077-1-sultanxda@gmail.com> Cc: netdev@vger.kernel.org, davem@davemloft.net, kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org To: sultanxda@gmail.com Return-path: Received: from mail-qt0-f194.google.com ([209.85.216.194]:34802 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752026AbeFFW5H (ORCPT ); Wed, 6 Jun 2018 18:57:07 -0400 Received: by mail-qt0-f194.google.com with SMTP id d3-v6so8246892qto.1 for ; Wed, 06 Jun 2018 15:57:07 -0700 (PDT) Sender: netdev-owner@vger.kernel.org List-ID: By passing a limit of 2 bytes to strncat, strncat is limited to writing fewer bytes than what it's supposed to append to the name here. Since the bounds are checked on the line above this, just remove the string bounds checks entirely since they're unneeded. Signed-off-by: Sultan Alsawaf --- net/ipv4/ip_tunnel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index 38d906baf1df..c4f5602308ed 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c @@ -261,8 +261,8 @@ static struct net_device *__ip_tunnel_create(struct net *net, } else { if (strlen(ops->kind) > (IFNAMSIZ - 3)) goto failed; - strlcpy(name, ops->kind, IFNAMSIZ); - strncat(name, "%d", 2); + strcpy(name, ops->kind); + strcat(name, "%d"); } ASSERT_RTNL(); -- 2.17.1