mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
memcpy(): pointers must be valid even if the size is 0
This commit is contained in:
@@ -232,8 +232,9 @@ crypto_hash_sha256_update(crypto_hash_sha256_state *state,
|
||||
in += 64;
|
||||
inlen -= 64;
|
||||
}
|
||||
memcpy(state->buf, in, inlen); /* inlen < 64 */
|
||||
|
||||
if (inlen > 0) {
|
||||
memcpy(state->buf, in, inlen); /* inlen < 64 */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -262,8 +262,9 @@ crypto_hash_sha512_update(crypto_hash_sha512_state *state,
|
||||
src += 128;
|
||||
inlen -= 128;
|
||||
}
|
||||
memcpy(state->buf, src, inlen); /* inlen < 128 */
|
||||
|
||||
if (inlen > 0) {
|
||||
memcpy(state->buf, src, inlen); /* inlen < 128 */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user