Patchwork [dpdk-dev,1/6] net/tap: use strlcpy for interface name

login
register
mail settings
Submitter Stephen Hemminger
Date Jan. 11, 2019, 6:06 p.m.
Message ID <20190111180659.5972-2-stephen@networkplumber.org>
Download mbox | patch
Permalink /patch/697963/
State New
Headers show

Comments

Stephen Hemminger - Jan. 11, 2019, 6:06 p.m.
snprintf is not needed here, use strlcpy instead.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/tap/rte_eth_tap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 0ec030bef63c..1c00681ba0eb 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -148,7 +148,7 @@  tun_alloc(struct pmd_internals *pmd, int is_keepalive)
 	 */
 	ifr.ifr_flags = (pmd->type == ETH_TUNTAP_TYPE_TAP) ?
 		IFF_TAP : IFF_TUN | IFF_POINTOPOINT;
-	snprintf(ifr.ifr_name, IFNAMSIZ, "%s", pmd->name);
+	strlcpy(ifr.ifr_name, pmd->name, IFNAMSIZ);
 
 	TAP_LOG(DEBUG, "ifr_name '%s'", ifr.ifr_name);