Skip to content

Commit c8ac14d

Browse files
committed
whitelist: fix SECP256K1_WHITELIST_MAX_N_KEYS constant
"MAX" should mean inclusive. And the whitelisting functions handled this inconsistently.
1 parent e290c0f commit c8ac14d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

include/secp256k1_whitelist.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
extern "C" {
1414
#endif
1515

16-
#define SECP256K1_WHITELIST_MAX_N_KEYS 256
16+
#define SECP256K1_WHITELIST_MAX_N_KEYS 255
1717

1818
/** Opaque data structure that holds a parsed whitelist proof
1919
*

src/modules/whitelist/main_impl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ int secp256k1_whitelist_signature_parse(const secp256k1_context* ctx, secp256k1_
144144
}
145145

146146
sig->n_keys = input[0];
147-
if (sig->n_keys >= MAX_KEYS || input_len != 1 + 32 * (sig->n_keys + 1)) {
147+
if (sig->n_keys > MAX_KEYS || input_len != 1 + 32 * (sig->n_keys + 1)) {
148148
return 0;
149149
}
150150
memcpy(&sig->data[0], &input[1], 32 * (sig->n_keys + 1));

0 commit comments

Comments
 (0)