summaryrefslogtreecommitdiff
path: root/drivers/net/i40e/rte_pmd_i40e.c
diff options
context:
space:
mode:
authorKirill Rybalchenko <kirill.rybalchenko@intel.com>2017-10-24 10:22:38 +0100
committerFerruh Yigit <ferruh.yigit@intel.com>2017-10-26 02:33:01 +0200
commit412f60a0e14ce51694489957b8ea9fa98d4b138f (patch)
tree43350613f6b5f9caf9781e7c08805a9cad0269c7 /drivers/net/i40e/rte_pmd_i40e.c
parent66c78f4799ff5021b749534cc35da2ae20f92397 (diff)
downloaddpdk-412f60a0e14ce51694489957b8ea9fa98d4b138f.zip
dpdk-412f60a0e14ce51694489957b8ea9fa98d4b138f.tar.gz
dpdk-412f60a0e14ce51694489957b8ea9fa98d4b138f.tar.xz
net/i40e: fix unsecure usage of strncpy function
Use more secure snprintf function instead of strncpy to prevent memory access violation. Fixes: 40d1324423a4 ("net/i40e: get ddp profile protocol info") Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com> Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
Diffstat (limited to 'drivers/net/i40e/rte_pmd_i40e.c')
-rw-r--r--drivers/net/i40e/rte_pmd_i40e.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index a4c6761..37da5cd 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -1927,8 +1927,8 @@ int rte_pmd_i40e_get_ddp_info(uint8_t *pkg_buff, uint32_t pkg_size,
tlv = (struct i40e_profile_tlv_section_record *)&proto[1];
for (i = j = 0; i < nb_rec; j++) {
pinfo[j].proto_id = tlv->data[0];
- strncpy(pinfo[j].name, (const char *)&tlv->data[1],
- I40E_DDP_NAME_SIZE);
+ snprintf(pinfo[j].name, I40E_DDP_NAME_SIZE, "%s",
+ (const char *)&tlv->data[1]);
i += tlv->len;
tlv = &tlv[tlv->len];
}