linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jes Sorensen <jes@trained-monkey.org>
To: Nigel Croxon <ncroxon@redhat.com>,
	mariusz.tkaczyk@linux.intel.com, neilb@suse.de, xni@redhat.com,
	linux-raid@vger.kernel.org
Subject: Re: [PATCH] Fix potential overlap dest buffer
Date: Fri, 8 Oct 2021 11:50:05 -0400	[thread overview]
Message-ID: <6e2f75ae-988e-3e00-6455-cbf9adb75aa7@trained-monkey.org> (raw)
In-Reply-To: <20210817131448.2496995-1-ncroxon@redhat.com>

On 8/17/21 9:14 AM, Nigel Croxon wrote:
> To meet requirements of Common Criteria certification vulnerablility
> assessment. Static code analysis has been run and found the following
> error.  Overlapping_buffer: The source buffer potentially overlaps
> with the destination buffer, which results in undefined
> behavior for "memcpy".
> 
> The change is to use memmove instead of memcpy.
> 
> Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
> ---
>  sha1.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sha1.c b/sha1.c
> index 11be7045..89b32f46 100644
> --- a/sha1.c
> +++ b/sha1.c
> @@ -258,7 +258,7 @@ sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
>  	{
>  	  sha1_process_block (ctx->buffer, 64, ctx);
>  	  left_over -= 64;
> -	  memcpy (ctx->buffer, &ctx->buffer[16], left_over);
> +	  memmove (ctx->buffer, &ctx->buffer[16], left_over);
>  	}
>        ctx->buflen = left_over;
>      }
> 

Applied!

Thanks,
Jes


      parent reply	other threads:[~2021-10-08 15:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-17 13:14 [PATCH] Fix potential overlap dest buffer Nigel Croxon
2021-08-17 21:40 ` NeilBrown
2021-08-18  6:34 ` Paul Menzel
2021-08-18 18:22   ` Nigel Croxon
2021-10-08 15:50 ` Jes Sorensen [this message]

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=6e2f75ae-988e-3e00-6455-cbf9adb75aa7@trained-monkey.org \
    --to=jes@trained-monkey.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=mariusz.tkaczyk@linux.intel.com \
    --cc=ncroxon@redhat.com \
    --cc=neilb@suse.de \
    --cc=xni@redhat.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).