Commit ad156c23 authored by Justin Stitt's avatar Justin Stitt Committed by Florian Westphal

netfilter: nft_meta: refactor deprecated strncpy

Prefer `strscpy_pad` to `strncpy`.
Signed-off-by: default avatarJustin Stitt <justinstitt@google.com>
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
parent 6d87a4ea
...@@ -185,12 +185,12 @@ static noinline bool nft_meta_get_eval_kind(enum nft_meta_keys key, ...@@ -185,12 +185,12 @@ static noinline bool nft_meta_get_eval_kind(enum nft_meta_keys key,
case NFT_META_IIFKIND: case NFT_META_IIFKIND:
if (!in || !in->rtnl_link_ops) if (!in || !in->rtnl_link_ops)
return false; return false;
strncpy((char *)dest, in->rtnl_link_ops->kind, IFNAMSIZ); strscpy_pad((char *)dest, in->rtnl_link_ops->kind, IFNAMSIZ);
break; break;
case NFT_META_OIFKIND: case NFT_META_OIFKIND:
if (!out || !out->rtnl_link_ops) if (!out || !out->rtnl_link_ops)
return false; return false;
strncpy((char *)dest, out->rtnl_link_ops->kind, IFNAMSIZ); strscpy_pad((char *)dest, out->rtnl_link_ops->kind, IFNAMSIZ);
break; break;
default: default:
return false; return false;
...@@ -206,7 +206,7 @@ static void nft_meta_store_ifindex(u32 *dest, const struct net_device *dev) ...@@ -206,7 +206,7 @@ static void nft_meta_store_ifindex(u32 *dest, const struct net_device *dev)
static void nft_meta_store_ifname(u32 *dest, const struct net_device *dev) static void nft_meta_store_ifname(u32 *dest, const struct net_device *dev)
{ {
strncpy((char *)dest, dev ? dev->name : "", IFNAMSIZ); strscpy_pad((char *)dest, dev ? dev->name : "", IFNAMSIZ);
} }
static bool nft_meta_store_iftype(u32 *dest, const struct net_device *dev) static bool nft_meta_store_iftype(u32 *dest, const struct net_device *dev)
......
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