Skip to content

Commit

Permalink
whitelist: fix SECP256K1_WHITELIST_MAX_N_KEYS constant
Browse files Browse the repository at this point in the history
"MAX" should mean inclusive. And the whitelisting functions handled this
inconsistently.
  • Loading branch information
jonasnick committed Oct 15, 2021
1 parent e290c0f commit c8ac14d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/secp256k1_whitelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
extern "C" {
#endif

#define SECP256K1_WHITELIST_MAX_N_KEYS 256
#define SECP256K1_WHITELIST_MAX_N_KEYS 255

/** Opaque data structure that holds a parsed whitelist proof
*
Expand Down
2 changes: 1 addition & 1 deletion src/modules/whitelist/main_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ int secp256k1_whitelist_signature_parse(const secp256k1_context* ctx, secp256k1_
}

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;
}
memcpy(&sig->data[0], &input[1], 32 * (sig->n_keys + 1));
Expand Down

0 comments on commit c8ac14d

Please sign in to comment.