net/tap: allow full length names
The code for set_interface_name was incorrectly assuming that space for null byte was necessary with snprintf/strlcpy. Fixes: 02f96a0a82d1 ("net/tap: add TUN/TAP device PMD") Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by Keith Wiles <keith.wiles@intel.com>
This commit is contained in:
parent
1d7490bc7c
commit
12ad0b6572
@ -1892,10 +1892,10 @@ set_interface_name(const char *key __rte_unused,
|
|||||||
char *name = (char *)extra_args;
|
char *name = (char *)extra_args;
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
strlcpy(name, value, RTE_ETH_NAME_MAX_LEN - 1);
|
strlcpy(name, value, RTE_ETH_NAME_MAX_LEN);
|
||||||
else
|
else
|
||||||
snprintf(name, RTE_ETH_NAME_MAX_LEN - 1, "%s%d",
|
snprintf(name, RTE_ETH_NAME_MAX_LEN, "%s%d",
|
||||||
DEFAULT_TAP_NAME, (tap_unit - 1));
|
DEFAULT_TAP_NAME, tap_unit - 1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user