whitelist: fix SECP256K1_WHITELIST_MAX_N_KEYS constant

"MAX" should mean inclusive. And the whitelisting functions handled this
inconsistently.
This commit is contained in:
Jonas Nick 2021-10-06 10:39:46 +00:00
parent e290c0f835
commit c8ac14d9dc
2 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,7 @@
extern "C" { extern "C" {
#endif #endif
#define SECP256K1_WHITELIST_MAX_N_KEYS 256 #define SECP256K1_WHITELIST_MAX_N_KEYS 255
/** Opaque data structure that holds a parsed whitelist proof /** Opaque data structure that holds a parsed whitelist proof
* *

View File

@ -144,7 +144,7 @@ int secp256k1_whitelist_signature_parse(const secp256k1_context* ctx, secp256k1_
} }
sig->n_keys = input[0]; sig->n_keys = input[0];
if (sig->n_keys >= MAX_KEYS || input_len != 1 + 32 * (sig->n_keys + 1)) { if (sig->n_keys > MAX_KEYS || input_len != 1 + 32 * (sig->n_keys + 1)) {
return 0; return 0;
} }
memcpy(&sig->data[0], &input[1], 32 * (sig->n_keys + 1)); memcpy(&sig->data[0], &input[1], 32 * (sig->n_keys + 1));