DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/vhost: fix potential overflow in args process
@ 2021-04-19  5:44 Cheng Jiang
  2021-04-26  8:24 ` [dpdk-dev] [dpdk-stable] " David Marchand
  2021-04-27  3:14 ` [dpdk-dev] [PATCH v2] " Cheng Jiang
  0 siblings, 2 replies; 6+ messages in thread
From: Cheng Jiang @ 2021-04-19  5:44 UTC (permalink / raw)
  To: maxime.coquelin, chenbo.xia; +Cc: dev, Cheng Jiang, stable

Add args length check to fix potential overflow issue.

Coverity issue: 363741
Fixes: 965b06f0358 ("examples/vhost: enhance getopt_long usage")
Cc: stable@dpdk.org

Signed-off-by: Cheng Jiang <Cheng1.jiang@intel.com>
---
 examples/vhost/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 119ba7e01..5df36ad3c 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -669,6 +669,11 @@ us_vhost_parse_args(int argc, char **argv)
 			break;
 
 		case OPT_DMA_TYPE_NUM:
+			if (strlen(optarg) >= MAX_LONG_OPT_SZ) {
+				RTE_LOG(INFO, VHOST_CONFIG, "Wrong DMA type\n");
+				us_vhost_usage(prgname);
+				return -1;
+			}
 			strcpy(dma_type, optarg);
 			break;
 
-- 
2.29.2


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

end of thread, other threads:[~2021-05-04  8:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-19  5:44 [dpdk-dev] [PATCH] examples/vhost: fix potential overflow in args process Cheng Jiang
2021-04-26  8:24 ` [dpdk-dev] [dpdk-stable] " David Marchand
2021-04-27  3:17   ` Jiang, Cheng1
2021-04-27  3:14 ` [dpdk-dev] [PATCH v2] " Cheng Jiang
2021-05-03 14:01   ` Maxime Coquelin
2021-05-04  8:28   ` Maxime Coquelin

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