Kaydet (Commit) 5940c535 authored tarafından Christian Heimes's avatar Christian Heimes

Issue #26798: Coverity complains about potential memcpy() of overlapped regions.…

Issue #26798: Coverity complains about potential memcpy() of overlapped regions. It doesn't hurt to use memmove() here. CID 1372514 / CID 1372515. Upstream https://github.com/BLAKE2/BLAKE2/issues/32
üst cf45ee10
...@@ -334,7 +334,7 @@ int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen ) ...@@ -334,7 +334,7 @@ int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen )
blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES ); blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );
blake2b_compress( S, S->buf ); blake2b_compress( S, S->buf );
S->buflen -= BLAKE2B_BLOCKBYTES; S->buflen -= BLAKE2B_BLOCKBYTES;
memcpy( S->buf, S->buf + BLAKE2B_BLOCKBYTES, S->buflen ); memmove( S->buf, S->buf + BLAKE2B_BLOCKBYTES, S->buflen );
} }
blake2b_increment_counter( S, S->buflen ); blake2b_increment_counter( S, S->buflen );
......
...@@ -371,7 +371,7 @@ int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen ) ...@@ -371,7 +371,7 @@ int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen )
blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES ); blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );
blake2b_compress( S, S->buf ); blake2b_compress( S, S->buf );
S->buflen -= BLAKE2B_BLOCKBYTES; S->buflen -= BLAKE2B_BLOCKBYTES;
memcpy( S->buf, S->buf + BLAKE2B_BLOCKBYTES, S->buflen ); memmove( S->buf, S->buf + BLAKE2B_BLOCKBYTES, S->buflen );
} }
blake2b_increment_counter( S, S->buflen ); blake2b_increment_counter( S, S->buflen );
......
...@@ -325,7 +325,7 @@ int blake2s_final( blake2s_state *S, uint8_t *out, uint8_t outlen ) ...@@ -325,7 +325,7 @@ int blake2s_final( blake2s_state *S, uint8_t *out, uint8_t outlen )
blake2s_increment_counter( S, BLAKE2S_BLOCKBYTES ); blake2s_increment_counter( S, BLAKE2S_BLOCKBYTES );
blake2s_compress( S, S->buf ); blake2s_compress( S, S->buf );
S->buflen -= BLAKE2S_BLOCKBYTES; S->buflen -= BLAKE2S_BLOCKBYTES;
memcpy( S->buf, S->buf + BLAKE2S_BLOCKBYTES, S->buflen ); memmove( S->buf, S->buf + BLAKE2S_BLOCKBYTES, S->buflen );
} }
blake2s_increment_counter( S, ( uint32_t )S->buflen ); blake2s_increment_counter( S, ( uint32_t )S->buflen );
......
...@@ -348,7 +348,7 @@ int blake2s_final( blake2s_state *S, uint8_t *out, uint8_t outlen ) ...@@ -348,7 +348,7 @@ int blake2s_final( blake2s_state *S, uint8_t *out, uint8_t outlen )
blake2s_increment_counter( S, BLAKE2S_BLOCKBYTES ); blake2s_increment_counter( S, BLAKE2S_BLOCKBYTES );
blake2s_compress( S, S->buf ); blake2s_compress( S, S->buf );
S->buflen -= BLAKE2S_BLOCKBYTES; S->buflen -= BLAKE2S_BLOCKBYTES;
memcpy( S->buf, S->buf + BLAKE2S_BLOCKBYTES, S->buflen ); memmove( S->buf, S->buf + BLAKE2S_BLOCKBYTES, S->buflen );
} }
blake2s_increment_counter( S, ( uint32_t )S->buflen ); blake2s_increment_counter( S, ( uint32_t )S->buflen );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment