netfilter: nf_tables: refactor deprecated strncpy
authorJustin Stitt <justinstitt@google.com>
Wed, 9 Aug 2023 01:06:06 +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_fib.c

index 601c9e0..04b51f2 100644 (file)
@@ -151,7 +151,7 @@ void nft_fib_store_result(void *reg, const struct nft_fib *priv,
                if (priv->flags & NFTA_FIB_F_PRESENT)
                        *dreg = !!dev;
                else
-                       strncpy(reg, dev ? dev->name : "", IFNAMSIZ);
+                       strscpy_pad(reg, dev ? dev->name : "", IFNAMSIZ);
                break;
        default:
                WARN_ON_ONCE(1);