diff options
author | Justin Stitt <justinstitt@google.com> | 2023-08-09 01:06:07 +0000 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2023-08-22 15:13:21 +0200 |
commit | ad156c23d65c1f44f8b4616c2a7505832e323069 (patch) | |
tree | 50015eac7b670c75176a725b437b53cde657c18a /net/netfilter | |
parent | 6d87a4eae89e2ae015b40fd0adc90e9a7dc9fccb (diff) | |
download | linux-ad156c23d65c1f44f8b4616c2a7505832e323069.tar.gz linux-ad156c23d65c1f44f8b4616c2a7505832e323069.tar.bz2 linux-ad156c23d65c1f44f8b4616c2a7505832e323069.zip |
netfilter: nft_meta: refactor deprecated strncpy
Prefer `strscpy_pad` to `strncpy`.
Signed-off-by: Justin Stitt <justinstitt@google.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'net/netfilter')
-rw-r--r-- | net/netfilter/nft_meta.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/netfilter/nft_meta.c b/net/netfilter/nft_meta.c index 8fdc7318c03c..f7da7c43333b 100644 --- a/net/netfilter/nft_meta.c +++ b/net/netfilter/nft_meta.c @@ -185,12 +185,12 @@ static noinline bool nft_meta_get_eval_kind(enum nft_meta_keys key, case NFT_META_IIFKIND: if (!in || !in->rtnl_link_ops) return false; - strncpy((char *)dest, in->rtnl_link_ops->kind, IFNAMSIZ); + strscpy_pad((char *)dest, in->rtnl_link_ops->kind, IFNAMSIZ); break; case NFT_META_OIFKIND: if (!out || !out->rtnl_link_ops) return false; - strncpy((char *)dest, out->rtnl_link_ops->kind, IFNAMSIZ); + strscpy_pad((char *)dest, out->rtnl_link_ops->kind, IFNAMSIZ); break; default: return false; @@ -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) { - 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) |