Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IdentifyMessage::decode allow failure on Unsupported MultiAddr #4759

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion network/src/protocols/identify/protocol.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use ckb_logger::warn;
use p2p::{bytes::Bytes, multiaddr::Multiaddr};

use ckb_types::{packed, prelude::*};
Expand Down Expand Up @@ -69,7 +70,12 @@ impl<'a> IdentifyMessage<'a> {
Multiaddr::try_from(reader.observed_addr().bytes().raw_data().to_vec()).ok()?;
let mut listen_addrs = Vec::with_capacity(reader.listen_addrs().len());
for addr in reader.listen_addrs().iter() {
listen_addrs.push(Multiaddr::try_from(addr.bytes().raw_data().to_vec()).ok()?)
match Multiaddr::try_from(addr.bytes().raw_data().to_vec()) {
Ok(multi_addr) => {
listen_addrs.push(multi_addr);
}
Err(err) => warn!("failed to decode listen_addr to MultiAddr: {}", err),
}
}

Some(IdentifyMessage {
Expand Down
Loading