DPDK patches and discussions
 help / color / mirror / Atom feed
From: Declan Doherty <declan.doherty@intel.com>
To: Pablo de Lara <pablo.de.lara.guarch@intel.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] l2fwd-crypto: fix coverity defect
Date: Thu, 7 Apr 2016 17:00:35 +0100	[thread overview]
Message-ID: <57068423.4050007@intel.com> (raw)
In-Reply-To: <1460035389-49395-1-git-send-email-pablo.de.lara.guarch@intel.com>

On 07/04/16 14:23, Pablo de Lara wrote:
> When parsing crypto device type, the string was being copied
> with strcpy(), which could overflow the destination buffer
> (which is 32 byte long), so snprintf() should be used instead.
>
> This fixes coverity issue 124575:
>
> /examples/l2fwd-crypto/main.c: 1005 in l2fwd_crypto_parse_args_long_options()
> *** CID 124575:    (STRING_OVERFLOW)
> 999
> 1000     	/* Authentication options */
> 1001     	else if (strcmp(lgopts[option_index].name, "auth_algo") == 0) {
> 1002     		retval = parse_auth_algo(&options->auth_xform.auth.algo,
> 1003     				optarg);
> 1004     		if (retval == 0)
>>>>      CID 124575:    (STRING_OVERFLOW)
>>>>      You might overrun the 32 byte fixed-size string "options->string_auth_algo" by copying "optarg" without checking the length.
> 1005     			strcpy(options->string_auth_algo, optarg);
> 1006     		return retval;
> 1007     	}
>
> Fixes: commit 49f79e86480d ("examples/l2fwd-crypto: add missing string initialization")
>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
...
>
Acked-by: Declan Doherty <declan.doherty@intel.com>

  reply	other threads:[~2016-04-07 16:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-07 13:23 Pablo de Lara
2016-04-07 16:00 ` Declan Doherty [this message]
2016-04-07 17:51   ` Thomas Monjalon

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=57068423.4050007@intel.com \
    --to=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=pablo.de.lara.guarch@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).