Commit 512b2dc4 authored by XueBing Chen's avatar XueBing Chen Committed by Jakub Kicinski

net: ip_tunnel: use strscpy to replace strlcpy

The strlcpy should not be used because it doesn't limit the source
length. Preferred is strscpy.
Signed-off-by: default avatarXueBing Chen <chenxuebing@jari.cn>
Link: https://lore.kernel.org/r/2a08f6c1.e30.181ed8b49ad.Coremail.chenxuebing@jari.cnSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 536a6c8e
...@@ -242,7 +242,7 @@ static struct net_device *__ip_tunnel_create(struct net *net, ...@@ -242,7 +242,7 @@ static struct net_device *__ip_tunnel_create(struct net *net,
if (parms->name[0]) { if (parms->name[0]) {
if (!dev_valid_name(parms->name)) if (!dev_valid_name(parms->name))
goto failed; goto failed;
strlcpy(name, parms->name, IFNAMSIZ); strscpy(name, parms->name, IFNAMSIZ);
} else { } else {
if (strlen(ops->kind) > (IFNAMSIZ - 3)) if (strlen(ops->kind) > (IFNAMSIZ - 3))
goto failed; goto failed;
...@@ -1065,7 +1065,7 @@ int ip_tunnel_init_net(struct net *net, unsigned int ip_tnl_net_id, ...@@ -1065,7 +1065,7 @@ int ip_tunnel_init_net(struct net *net, unsigned int ip_tnl_net_id,
memset(&parms, 0, sizeof(parms)); memset(&parms, 0, sizeof(parms));
if (devname) if (devname)
strlcpy(parms.name, devname, IFNAMSIZ); strscpy(parms.name, devname, IFNAMSIZ);
rtnl_lock(); rtnl_lock();
itn->fb_tunnel_dev = __ip_tunnel_create(net, ops, &parms); itn->fb_tunnel_dev = __ip_tunnel_create(net, ops, &parms);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment