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:
John Moffett
2025-09-01 09:18:48 -04:00
parent f36afb8b3d
commit 960ba5f9c6

View File

@@ -265,7 +265,7 @@ static void secp256k1_rfc6979_hmac_sha256_generate(secp256k1_rfc6979_hmac_sha256
while (outlen > 0) {
secp256k1_hmac_sha256 hmac;
int now = outlen;
size_t now = outlen;
secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32);
secp256k1_hmac_sha256_write(&hmac, rng->v, 32);
secp256k1_hmac_sha256_finalize(&hmac, rng->v);