Use size_t instead of int for RFC6979 outlen copy
If outlen is > INT_MAX, could trigger segfault or hang after copy int now = outlen.
This commit is contained in:
@@ -265,7 +265,7 @@ static void secp256k1_rfc6979_hmac_sha256_generate(secp256k1_rfc6979_hmac_sha256
|
|||||||
|
|
||||||
while (outlen > 0) {
|
while (outlen > 0) {
|
||||||
secp256k1_hmac_sha256 hmac;
|
secp256k1_hmac_sha256 hmac;
|
||||||
int now = outlen;
|
size_t now = outlen;
|
||||||
secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32);
|
secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32);
|
||||||
secp256k1_hmac_sha256_write(&hmac, rng->v, 32);
|
secp256k1_hmac_sha256_write(&hmac, rng->v, 32);
|
||||||
secp256k1_hmac_sha256_finalize(&hmac, rng->v);
|
secp256k1_hmac_sha256_finalize(&hmac, rng->v);
|
||||||
|
|||||||
Reference in New Issue
Block a user