]> git.droids-corp.org - dpdk.git/blobdiff - lib/librte_ether/rte_ethdev.c
ethdev: fix invalid length write on detach
[dpdk.git] / lib / librte_ether / rte_ethdev.c
index 805ef639c19f37a15d906c9e4c656a4ce49a2bd7..0597641eea49d38abf06927fae3d6ba44e62b4d7 100644 (file)
@@ -436,8 +436,8 @@ rte_eth_dev_detach(uint8_t port_id, char *name)
        if (rte_eth_dev_is_detachable(port_id))
                goto err;
 
-       snprintf(name, sizeof(rte_eth_devices[port_id].device->name),
-                "%s", rte_eth_devices[port_id].device->name);
+       snprintf(name, RTE_DEV_NAME_MAX_LEN, "%s",
+                rte_eth_devices[port_id].device->name);
 
        ret = rte_eal_dev_detach(rte_eth_devices[port_id].device);
        if (ret < 0)