From 936f8f10b619626dae1961d7fffa60a1788d16aa Mon Sep 17 00:00:00 2001 From: Sultan Alsawaf Date: Wed, 6 Jun 2018 15:56:54 -0700 Subject: [PATCH] ip_tunnel: Fix name string concatenate in __ip_tunnel_create() 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 Signed-off-by: David S. Miller [sw0312.kim: cherry-pick mainline commit 000ade80164 for gcc 9 build] Signed-off-by: Seung-Woo Kim Change-Id: Iea412bf5398b91fcdc471952a289d406ea26d677 --- 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 84aa69c..c703867 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c @@ -292,8 +292,8 @@ static struct net_device *__ip_tunnel_create(struct net *net, err = -E2BIG; goto failed; } - strlcpy(name, ops->kind, IFNAMSIZ); - strncat(name, "%d", 2); + strcpy(name, ops->kind); + strcat(name, "%d"); } ASSERT_RTNL(); -- 2.7.4