diff options
author | Nick Clifton <nickc@redhat.com> | 2021-03-16 14:43:17 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2021-03-16 14:43:17 +0000 |
commit | f6e9c1c9191c8b9998e03cb15de8600a2a4b9188 (patch) | |
tree | b3da74834f18fc29fc0c70559ae6ba0e091adf75 | |
parent | 408d137027b1c39546d39fdbca7347b3dddba8ea (diff) | |
download | gcc-f6e9c1c9191c8b9998e03cb15de8600a2a4b9188.zip gcc-f6e9c1c9191c8b9998e03cb15de8600a2a4b9188.tar.gz gcc-f6e9c1c9191c8b9998e03cb15de8600a2a4b9188.tar.bz2 |
Fix potentially undefined behaviour when computing a sha1 value.
libiberty/
* sha1.c (sha1_process_bytes): Use memmove in place of memcpy.
-rw-r--r-- | libiberty/sha1.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libiberty/sha1.c b/libiberty/sha1.c index e3d7f86..7d15d48 100644 --- a/libiberty/sha1.c +++ b/libiberty/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; } |