DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/i40e: fix value of num parameter for strncpy function
@ 2017-10-23 11:24 Kirill Rybalchenko
  2017-10-23 12:57 ` Bruce Richardson
  2017-10-24  9:22 ` [dpdk-dev] [PATCH] net/i40e: fix unsecure usage of " Kirill Rybalchenko
  0 siblings, 2 replies; 7+ messages in thread
From: Kirill Rybalchenko @ 2017-10-23 11:24 UTC (permalink / raw)
  To: dev; +Cc: kirill.rybalchenko, andrey.chilikin, beilei.xing, jingjing.wu

num parameter for strncpy() function should be smaller than
actual destination buffer size to allow null termination.

Fixes: 40d1324423a4 ("net/i40e: get ddp profile protocol info")

Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
---
 drivers/net/i40e/rte_pmd_i40e.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index 4881ea0..489f66b 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -1928,7 +1928,7 @@ int rte_pmd_i40e_get_ddp_info(uint8_t *pkg_buff, uint32_t pkg_size,
 		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);
+				I40E_DDP_NAME_SIZE - 1);
 			i += tlv->len;
 			tlv = &tlv[tlv->len];
 		}
-- 
2.5.5

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-10-24 18:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-23 11:24 [dpdk-dev] [PATCH] net/i40e: fix value of num parameter for strncpy function Kirill Rybalchenko
2017-10-23 12:57 ` Bruce Richardson
2017-10-23 13:06   ` Rybalchenko, Kirill
2017-10-23 13:30     ` Bruce Richardson
2017-10-24  9:22 ` [dpdk-dev] [PATCH] net/i40e: fix unsecure usage of " Kirill Rybalchenko
2017-10-24  9:50   ` Bruce Richardson
2017-10-24 18:12     ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).