DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Cheng Jiang <Cheng1.jiang@intel.com>, chenbo.xia@intel.com
Cc: dev@dpdk.org, patrick.fu@intel.com, YvonneX.Yang@intel.com
Subject: Re: [dpdk-dev] [PATCH v1] examples/vhost: fix missing args length check
Date: Tue, 10 Nov 2020 10:44:04 +0100	[thread overview]
Message-ID: <a7544ce8-8504-2ed8-c1d8-9b2ef39e6898@redhat.com> (raw)
In-Reply-To: <20201106032401.9149-1-Cheng1.jiang@intel.com>



On 11/6/20 4:24 AM, Cheng Jiang wrote:
> Add args length check before copying to fix the coverity issue.
> 
> Fixes: 3a04ecb21420 ("examples/vhost: add async vhost args parsing")
> Coverity issue: 363741
> 
> Signed-off-by: Cheng Jiang <Cheng1.jiang@intel.com>
> ---
>  examples/vhost/main.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/examples/vhost/main.c b/examples/vhost/main.c
> index 59a1aff07c..ec88874d16 100644
> --- a/examples/vhost/main.c
> +++ b/examples/vhost/main.c
> @@ -634,6 +634,12 @@ us_vhost_parse_args(int argc, char **argv)
>  
>  			if (!strncmp(long_option[option_index].name,
>  						"dma-type", MAX_LONG_OPT_SZ)) {
> +				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);
>  			}
>  
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


  reply	other threads:[~2020-11-10  9:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06  3:24 Cheng Jiang
2020-11-10  9:44 ` Maxime Coquelin [this message]
2020-11-13  8:41 ` Maxime Coquelin

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=a7544ce8-8504-2ed8-c1d8-9b2ef39e6898@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=Cheng1.jiang@intel.com \
    --cc=YvonneX.Yang@intel.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=patrick.fu@intel.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).