Skip to content

Commit ada5277

Browse files
committed
descriptor: limit sortedmulti() to 20 keys
Signed-off-by: Antoine Poinsot <[email protected]>
1 parent 79a0e62 commit ada5277

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/descriptor/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,11 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> SortedMultiVec<Pk, Ctx> {
14251425
///
14261426
/// Internally checks all the applicable size limits and pubkey types limitations according to the current `Ctx`.
14271427
pub fn new(k: usize, pks: Vec<Pk>) -> Result<Self, Error> {
1428+
// A sortedmulti() is only defined for <= 20 keys (it maps to CHECKMULTISIG)
1429+
if pks.len() > 20 {
1430+
Error::BadDescriptor("Too many public keys".to_string());
1431+
}
1432+
14281433
// Check the limits before creating a new SortedMultiVec
14291434
// For example, under p2sh context the scriptlen can only be
14301435
// upto 520 bytes.

0 commit comments

Comments
 (0)