From: Gao Feng <[email protected]>

The current codes use strncpy to copy the dev name in
nf_tables_newchain, there is no real issue now. Because the sizes of
src and dst are IFNAMSIZ. But normally it should use count-1 with
strncpy, because strncpy doesn't make sure the dst must be
NULL-terminated when src exceeds the count bytes.
So use strlcpy to replace the strncpy to make it clearer.

Signed-off-by: Gao Feng <[email protected]>
---
 net/netfilter/nf_tables_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index a019a87..dc50801 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -1488,7 +1488,7 @@ static int nf_tables_newchain(struct net *net, struct 
sock *nlsk,
                }
 
                if (hook.dev != NULL)
-                       strncpy(basechain->dev_name, hook.dev->name, IFNAMSIZ);
+                       strlcpy(basechain->dev_name, hook.dev->name, IFNAMSIZ);
 
                if (nla[NFTA_CHAIN_COUNTERS]) {
                        stats = nft_stats_alloc(nla[NFTA_CHAIN_COUNTERS]);
-- 
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to