net/tap: use strlcpy for interface name
authorStephen Hemminger <stephen@networkplumber.org>
Fri, 11 Jan 2019 20:35:14 +0000 (12:35 -0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 14 Jan 2019 16:44:29 +0000 (17:44 +0100)
snprintf is not needed here, use strlcpy instead.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by Keith Wiles <keith.wiles@intel.com>

drivers/net/tap/rte_eth_tap.c

index 0ec030b..1c00681 100644 (file)
@@ -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);