patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Cheng Jiang <Cheng1.jiang@intel.com>
To: maxime.coquelin@redhat.com, chenbo.xia@intel.com
Cc: dev@dpdk.org, Cheng Jiang <Cheng1.jiang@intel.com>, stable@dpdk.org
Subject: [dpdk-stable] [PATCH] examples/vhost: fix potential overflow in args process
Date: Mon, 19 Apr 2021 05:44:26 +0000
Message-ID: <20210419054426.26812-1-Cheng1.jiang@intel.com> (raw)

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


             reply	other threads:[~2021-04-19  5:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19  5:44 Cheng Jiang [this message]
2021-04-26  8:24 ` David Marchand
2021-04-27  3:17   ` Jiang, Cheng1

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210419054426.26812-1-Cheng1.jiang@intel.com \
    --to=cheng1.jiang@intel.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git