All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix potential overlap dest buffer
@ 2021-08-17 13:14 Nigel Croxon
  2021-08-17 21:40 ` NeilBrown
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Nigel Croxon @ 2021-08-17 13:14 UTC (permalink / raw)
  To: jes, mariusz.tkaczyk, neilb, xni, linux-raid

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


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

end of thread, other threads:[~2021-10-08 15:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.