DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] examples/vhost: fix missing args length check
@ 2020-11-06  3:24 Cheng Jiang
  2020-11-10  9:44 ` Maxime Coquelin
  2020-11-13  8:41 ` Maxime Coquelin
  0 siblings, 2 replies; 3+ messages in thread
From: Cheng Jiang @ 2020-11-06  3:24 UTC (permalink / raw)
  To: maxime.coquelin, chenbo.xia; +Cc: dev, patrick.fu, YvonneX.Yang, Cheng Jiang

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);
 			}
 
-- 
2.29.2


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

* Re: [dpdk-dev] [PATCH v1] examples/vhost: fix missing args length check
  2020-11-06  3:24 [dpdk-dev] [PATCH v1] examples/vhost: fix missing args length check Cheng Jiang
@ 2020-11-10  9:44 ` Maxime Coquelin
  2020-11-13  8:41 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2020-11-10  9:44 UTC (permalink / raw)
  To: Cheng Jiang, chenbo.xia; +Cc: dev, patrick.fu, YvonneX.Yang



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


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

* Re: [dpdk-dev] [PATCH v1] examples/vhost: fix missing args length check
  2020-11-06  3:24 [dpdk-dev] [PATCH v1] examples/vhost: fix missing args length check Cheng Jiang
  2020-11-10  9:44 ` Maxime Coquelin
@ 2020-11-13  8:41 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2020-11-13  8:41 UTC (permalink / raw)
  To: Cheng Jiang, chenbo.xia; +Cc: dev, patrick.fu, YvonneX.Yang



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(+)

Applied to dpdk-next-virtio/main.

Thanks,
Maxime


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

end of thread, other threads:[~2020-11-13  8:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-06  3:24 [dpdk-dev] [PATCH v1] examples/vhost: fix missing args length check Cheng Jiang
2020-11-10  9:44 ` Maxime Coquelin
2020-11-13  8:41 ` Maxime Coquelin

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/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 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

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


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