From e5158a130979e399f011489d6999170d01641aa0 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 22 Mar 2022 12:30:56 +0100 Subject: [PATCH] Fix threshold after which a protocol name is too long (#2162) * Fix threshold after which a protocol name is too long * Link to PR in changelog * Fix changelog item position --- bin/wasm-node/CHANGELOG.md | 4 ++++ src/libp2p/connection/multistream_select.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/wasm-node/CHANGELOG.md b/bin/wasm-node/CHANGELOG.md index fe625826ab..7d2d3e8276 100644 --- a/bin/wasm-node/CHANGELOG.md +++ b/bin/wasm-node/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Fixed + +- Increase the threshold after which smoldot considers that a protocol name sent through multistream-select is an attempt at a DoS attack, to accomodate for the change in the GrandPa protocol name in Substrate. ([#2162](https://github.com/paritytech/smoldot/pull/2162)) + ## 0.6.6 - 2022-03-18 ### Added diff --git a/src/libp2p/connection/multistream_select.rs b/src/libp2p/connection/multistream_select.rs index 3bba32000d..bbc39ee1a5 100644 --- a/src/libp2p/connection/multistream_select.rs +++ b/src/libp2p/connection/multistream_select.rs @@ -169,7 +169,7 @@ where // legitimately requests a protocol that the listener doesn't support. In order to prevent // confusion, a minimum length is applied to the protocol name length. Any protocol name // smaller than this will never trigger a protocol error, even if it isn't supported. - const MIN_PROTO_LEN_NO_ERR: usize = 48; + const MIN_PROTO_LEN_NO_ERR: usize = 512; let max_frame_len = cmp::max( cmp::max(max_proto_name_len, MIN_PROTO_LEN_NO_ERR), HANDSHAKE.len(),