DPDK patches and discussions
 help / color / mirror / Atom feed
From: "De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>
To: "Mrozowicz, SlawomirX" <slawomirx.mrozowicz@intel.com>,
	"Doherty, Declan" <declan.doherty@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"Mrozowicz, SlawomirX" <slawomirx.mrozowicz@intel.com>
Subject: Re: [dpdk-dev] [PATCH] app/crypto-perf: fix dereference null return	value
Date: Thu, 9 Feb 2017 22:31:31 +0000	[thread overview]
Message-ID: <E115CCD9D858EF4F90C690B0DCB4D897476D7B3F@IRSMSX108.ger.corp.intel.com> (raw)
In-Reply-To: <1486392910-8183-1-git-send-email-slawomirx.mrozowicz@intel.com>

Hi Slawomir,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Slawomir
> Mrozowicz
> Sent: Monday, February 06, 2017 2:55 PM
> To: Doherty, Declan
> Cc: dev@dpdk.org; Mrozowicz, SlawomirX
> Subject: [dpdk-dev] [PATCH] app/crypto-perf: fix dereference null return
> value
> 
> Dereferencing a pointer that might be null key_token when calling strstr.
> Check if the pointer is null before.
> 
> Coverity issue: 141071
> Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test
> application")
> 
> Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
> ---
>  app/test-crypto-perf/cperf_test_vector_parsing.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.c b/app/test-
> crypto-perf/cperf_test_vector_parsing.c
> index e0bcb20..a7d7b51 100644
> --- a/app/test-crypto-perf/cperf_test_vector_parsing.c
> +++ b/app/test-crypto-perf/cperf_test_vector_parsing.c
> @@ -240,7 +240,7 @@ parse_entry(char *entry, struct cperf_test_vector
> *vector,
> 
>  	/* get values for key */
>  	token = strtok(NULL, CPERF_ENTRY_DELIMITER);
> -	if (token == NULL) {
> +	if (key_token == NULL || token == NULL) {

Is this fix right? If key_token is NULL, then I would expect a seg fault here.

>  		printf("Expected 'key = values' but was '%.40s'..\n",
>  			key_token);
>  		return -1;
> --
> 2.5.0

Thanks,
Pablo

  reply	other threads:[~2017-02-09 22:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-06 14:55 Slawomir Mrozowicz
2017-02-09 22:31 ` De Lara Guarch, Pablo [this message]
2017-02-10 14:22 ` [dpdk-dev] [PATCH v2] " Slawomir Mrozowicz
2017-02-10 13:24   ` De Lara Guarch, Pablo
2017-02-10 13:40     ` De Lara Guarch, Pablo

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=E115CCD9D858EF4F90C690B0DCB4D897476D7B3F@IRSMSX108.ger.corp.intel.com \
    --to=pablo.de.lara.guarch@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=slawomirx.mrozowicz@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).