1
0
Fork 0
mirror of https://github.com/BLAKE3-team/BLAKE3 synced 2024-06-23 17:57:21 +02:00

C impl: Prevent memcpy undefined behavior

This commit is contained in:
Guido Vranken 2020-01-09 21:13:15 +01:00 committed by Jack O'Connor
parent 8d3f33802d
commit 253e830c26

View File

@ -34,6 +34,9 @@ INLINE size_t chunk_state_len(const blake3_chunk_state *self) {
INLINE size_t chunk_state_fill_buf(blake3_chunk_state *self,
const uint8_t *input, size_t input_len) {
if (input_len == 0) {
return 0;
}
size_t take = BLAKE3_BLOCK_LEN - ((size_t)self->buf_len);
if (take > input_len) {
take = input_len;