Merge pull request #10795 from kaspar030/fix_sha256_update_with_zero_length
hashes/sha256: don't call memcpy if len==0
This commit is contained in:
commit
b6eb12c6d4
@ -223,7 +223,9 @@ void sha256_update(sha256_context_t *ctx, const void *data, size_t len)
|
|||||||
|
|
||||||
/* Handle the case where we don't need to perform any transforms */
|
/* Handle the case where we don't need to perform any transforms */
|
||||||
if (len < 64 - r) {
|
if (len < 64 - r) {
|
||||||
memcpy(&ctx->buf[r], data, len);
|
if (len > 0) {
|
||||||
|
memcpy(&ctx->buf[r], data, len);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user