DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] app/graph: fix destination buffer too small
@ 2024-06-23 20:09 Mahmoud Maatuq
  2024-06-23 20:26 ` Stephen Hemminger
  2024-06-24 20:01 ` [PATCH v2] " Mahmoud Maatuq
  0 siblings, 2 replies; 9+ messages in thread
From: Mahmoud Maatuq @ 2024-06-23 20:09 UTC (permalink / raw)
  To: Sunil Kumar Kori, Rakesh Kudurumalla, Jerin Jacob, Nithin Dabilpuram
  Cc: dev, Mahmoud Maatuq

as sizeof(config.rx.mempool_name) is < sizeof(res->mempool), it's safer
to copy min size of them to avoide out of bound memory write.

Coverity issue: 415430
Fixes: 3850cb06ab9c ("app/graph: add ethdev commands")
Cc: skori@marvell.com

Signed-off-by: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
---
 app/graph/ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/graph/ethdev.c b/app/graph/ethdev.c
index cfc1b18569..4b6009ee12 100644
--- a/app/graph/ethdev.c
+++ b/app/graph/ethdev.c
@@ -671,7 +671,8 @@ cmd_ethdev_parsed(void *parsed_result, __rte_unused struct cmdline *cl, void *da
 	memset(&config, 0, sizeof(struct ethdev_config));
 	config.rx.n_queues = res->nb_rxq;
 	config.rx.queue_size = ETHDEV_RX_DESC_DEFAULT;
-	memcpy(config.rx.mempool_name, res->mempool, strlen(res->mempool));
+	memcpy(config.rx.mempool_name, res->mempool,
+		RTE_MIN(sizeof(config.rx.mempool_name), strlen(res->mempool)));
 
 	config.tx.n_queues = res->nb_txq;
 	config.tx.queue_size = ETHDEV_TX_DESC_DEFAULT;
-- 
2.43.0


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

end of thread, other threads:[~2024-07-06 14:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-23 20:09 [PATCH] app/graph: fix destination buffer too small Mahmoud Maatuq
2024-06-23 20:26 ` Stephen Hemminger
2024-06-26 20:22   ` Mahmoud Matook
2024-06-24 20:01 ` [PATCH v2] " Mahmoud Maatuq
2024-06-25  4:41   ` [EXTERNAL] " Kiran Kumar Kokkilagadda
2024-06-26 20:18     ` Mahmoud Matook
2024-06-27  0:43       ` Kiran Kumar Kokkilagadda
2024-07-04 15:17         ` David Marchand
2024-07-06 14:08           ` Mahmoud Matook

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).