netfilter: nf_tables: refactor deprecated strncpy
authorJustin Stitt <justinstitt@google.com>
Wed, 9 Aug 2023 01:06:05 +0000 (01:06 +0000)
committerFlorian Westphal <fw@strlen.de>
Tue, 22 Aug 2023 13:13:21 +0000 (15:13 +0200)
Prefer `strscpy_pad` over `strncpy`.

Signed-off-by: Justin Stitt <justinstitt@google.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
net/netfilter/nft_ct.c

index e87fd43..86bb9d7 100644 (file)
@@ -108,7 +108,7 @@ static void nft_ct_get_eval(const struct nft_expr *expr,
                helper = rcu_dereference(help->helper);
                if (helper == NULL)
                        goto err;
-               strncpy((char *)dest, helper->name, NF_CT_HELPER_NAME_LEN);
+               strscpy_pad((char *)dest, helper->name, NF_CT_HELPER_NAME_LEN);
                return;
 #ifdef CONFIG_NF_CONNTRACK_LABELS
        case NFT_CT_LABELS: {