提交 000ade80 编写于 作者: S Sultan Alsawaf 提交者: David S. Miller

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: NSultan Alsawaf <sultanxda@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 52acf73b
...@@ -261,8 +261,8 @@ static struct net_device *__ip_tunnel_create(struct net *net, ...@@ -261,8 +261,8 @@ static struct net_device *__ip_tunnel_create(struct net *net,
} else { } else {
if (strlen(ops->kind) > (IFNAMSIZ - 3)) if (strlen(ops->kind) > (IFNAMSIZ - 3))
goto failed; goto failed;
strlcpy(name, ops->kind, IFNAMSIZ); strcpy(name, ops->kind);
strncat(name, "%d", 2); strcat(name, "%d");
} }
ASSERT_RTNL(); ASSERT_RTNL();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册