mirror of
https://github.com/BLAKE3-team/BLAKE3
synced 2024-09-28 15:11:34 +02:00
C impl: Prevent memcpy undefined behavior
This commit is contained in:
parent
8d3f33802d
commit
253e830c26
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user